id
int64
0
755k
file_name
stringlengths
3
109
file_path
stringlengths
13
185
content
stringlengths
31
9.38M
size
int64
31
9.38M
language
stringclasses
1 value
extension
stringclasses
11 values
total_lines
int64
1
340k
avg_line_length
float64
2.18
149k
max_line_length
int64
7
2.22M
alphanum_fraction
float64
0
1
repo_name
stringlengths
6
65
repo_stars
int64
100
47.3k
repo_forks
int64
0
12k
repo_open_issues
int64
0
3.4k
repo_license
stringclasses
9 values
repo_extraction_date
stringclasses
92 values
exact_duplicates_redpajama
bool
2 classes
near_duplicates_redpajama
bool
2 classes
exact_duplicates_githubcode
bool
2 classes
exact_duplicates_stackv2
bool
1 class
exact_duplicates_stackv1
bool
2 classes
near_duplicates_githubcode
bool
2 classes
near_duplicates_stackv1
bool
2 classes
near_duplicates_stackv2
bool
1 class
13,254
videorgbparadescopewidget.cpp
mltframework_shotcut/src/widgets/scopes/videorgbparadescopewidget.cpp
/* * Copyright (c) 2019-2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "videorgbparadescopewidget.h" #include <QMouseEvent> #include <QPainter> #include <QToolTip> static const QColor TEXT_COLOR = {255, 255, 255, 127}; VideoRgbParadeScopeWidget::VideoRgbParadeScopeWidget() : ScopeWidget("RgbParade") , m_frame() , m_renderImg() , m_mutex() , m_displayImg() { LOG_DEBUG() << "begin"; setMouseTracking(true); LOG_DEBUG() << "end"; } void VideoRgbParadeScopeWidget::refreshScope(const QSize &size, bool full) { Q_UNUSED(size) Q_UNUSED(full) while (m_queue.count() > 0) { m_frame = m_queue.pop(); } int width = m_frame.get_image_width(); int height = m_frame.get_image_height(); if (m_frame.is_valid() && width && height) { int imgWidth = width * 3; if (m_renderImg.width() != imgWidth) { m_renderImg = QImage(imgWidth, 256, QImage::QImage::Format_RGBX8888); } QColor bgColor( 0, 0, 0, 0xff ); m_renderImg.fill(bgColor); const uint8_t *src = m_frame.get_image(mlt_image_rgb); uint8_t *dst = m_renderImg.scanLine(0); size_t rOffset = 0; size_t gOffset = rOffset + width; size_t bOffset = gOffset + width; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { uint8_t ry = 255 - src[0]; size_t rIndex = (ry * imgWidth + rOffset + x) * 4; if (dst[rIndex] < 0xff) { dst[rIndex] += 0x0f; } uint8_t gy = 255 - src[1]; size_t gIndex = (gy * imgWidth + gOffset + x) * 4 + 1; if (dst[gIndex] < 0xff) { dst[gIndex] += 0x0f; } uint8_t by = 255 - src[2]; size_t bIndex = (by * imgWidth + bOffset + x) * 4 + 2; if (dst[bIndex] < 0xff) { dst[bIndex] += 0x0f; } src += 3; } } QImage scaledImage = m_renderImg.scaled(size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation).convertToFormat(QImage::Format_RGB32); m_mutex.lock(); m_displayImg.swap(m_renderImg); m_mutex.unlock(); } } void VideoRgbParadeScopeWidget::paintEvent(QPaintEvent *) { if (!isVisible()) return; // Create the painter QPainter p(this); p.setRenderHint(QPainter::Antialiasing, true); QFont font = QWidget::font(); int fontSize = font.pointSize() - (font.pointSize() > 10 ? 2 : (font.pointSize() > 8 ? 1 : 0)); font.setPointSize(fontSize); QFontMetrics fm(font); QPen pen; pen.setColor(TEXT_COLOR); pen.setWidth(qRound(devicePixelRatioF())); p.setPen(pen); p.setFont(font); // draw the waveform data m_mutex.lock(); if (!m_displayImg.isNull()) { p.drawImage(rect(), m_displayImg, m_displayImg.rect()); } else { p.fillRect(rect(), QBrush(Qt::black, Qt::SolidPattern)); } m_mutex.unlock(); // Draw the graticule int textpad = 3; int textheight = fm.tightBoundingRect("0").height(); qreal y = 0; // 255 y = 0; p.drawLine(QPointF(0, y), QPointF(width(), y)); p.drawText(textpad, textheight + textpad, tr("255")); // 191 y = (qreal)height() - 191.0 / 255.0 * (qreal)height(); p.drawLine(0, y, width(), y); p.drawText(textpad, height() / 4 - textpad, tr("191")); // 127 y = (qreal)height() - 127.0 / 255.0 * (qreal)height(); p.drawLine(0, y, width(), y); p.drawText(textpad, height() / 2 - textpad, tr("127")); // 64 y = (qreal)height() - 64.0 / 255.0 * (qreal)height(); p.drawLine(0, y, width(), y); p.drawText(textpad, height() * 3 / 4 - textpad, tr("64")); // 0 y = height(); p.drawLine(0, y, width(), y); p.drawText(textpad, height() - textpad, tr("0")); } void VideoRgbParadeScopeWidget::mouseMoveEvent(QMouseEvent *event) { QString text; qreal channelWidth = width() / 3.0; qreal channelX = event->pos().x() % (int)channelWidth; QString channelLabel; if (event->pos().x() < channelWidth) { channelLabel = tr("Red"); } else if (event->pos().x() < channelWidth * 2) { channelLabel = tr("Green"); } else { channelLabel = tr("Blue"); } m_mutex.lock(); int frameWidth = m_displayImg.width() / 3; m_mutex.unlock(); int value = 255 - (255 * event->pos().y() / height()); if (frameWidth != 0) { int pixel = frameWidth * channelX / channelWidth; text = tr("Channel: %1\nPixel: %2\nValue: %3").arg(channelLabel).arg(pixel).arg(value); } else { text = tr("Channel: %1\nValue: %2").arg(channelLabel).arg(value); } QToolTip::showText(event->globalPosition().toPoint(), text); } QString VideoRgbParadeScopeWidget::getTitle() { return tr("Video RGB Parade"); }
5,637
C++
.cpp
158
28.962025
112
0.587168
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
13,255
audiovectorscopewidget.cpp
mltframework_shotcut/src/widgets/scopes/audiovectorscopewidget.cpp
/* * Copyright (c) 2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "audiovectorscopewidget.h" #include <Logger.h> #include "settings.h" #include <QComboBox> #include <QHBoxLayout> #include <QLabel> #include <QPainter> #include <QVBoxLayout> #include <cmath> static const qreal MAX_AMPLITUDE = 32768.0; AudioVectorScopeWidget::AudioVectorScopeWidget() : ScopeWidget("AudioVector") , m_mutex() , m_c1Index(0) , m_c2Index(1) { LOG_DEBUG() << "begin"; setMinimumSize(100, 100); QVBoxLayout *vlayout = new QVBoxLayout(this); vlayout->setContentsMargins(0, 0, 0, 0); vlayout->setSpacing(0); QHBoxLayout *hlayout = new QHBoxLayout; hlayout->setContentsMargins(0, 0, 0, 0); hlayout->setSpacing(0); vlayout->addLayout(hlayout); m_c1Combo = new QComboBox(this); m_c2Combo = new QComboBox(this); QWidget *spacer = new QWidget(this); spacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); hlayout->addWidget(m_c1Combo); hlayout->addWidget(spacer); hlayout->addWidget(m_c2Combo); m_imgLabel = new QLabel(this); m_imgLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); m_imgLabel->setAlignment(Qt::AlignHCenter | Qt::AlignTop); vlayout->addWidget(m_imgLabel); setLayout(vlayout); connect(&Settings, &ShotcutSettings::playerAudioChannelsChanged, this, [&]() { setComboBoxOptions(); requestRefresh(); }); connect(m_c1Combo, &QComboBox::currentIndexChanged, this, [&](int index) { m_c1Index = index; requestRefresh(); }); connect(m_c2Combo, &QComboBox::currentIndexChanged, this, [&](int index) { m_c2Index = index; requestRefresh(); }); setComboBoxOptions(); LOG_DEBUG() << "end"; } AudioVectorScopeWidget::~AudioVectorScopeWidget() { } void AudioVectorScopeWidget::setComboBoxOptions() { int channels = Settings.playerAudioChannels(); m_c1Combo->clear(); m_c2Combo->clear(); if (channels == 1) { m_c1Combo->addItem(tr("C")); m_c2Combo->addItem(tr("C")); } else if (channels > 1) { m_c1Combo->addItem(tr("L")); m_c1Combo->addItem(tr("R")); m_c2Combo->addItem(tr("L")); m_c2Combo->addItem(tr("R")); } if (channels > 2 && channels != 4) { m_c1Combo->addItem(tr("C")); m_c2Combo->addItem(tr("C")); } if (channels > 3) { m_c1Combo->addItem(tr("Ls")); m_c1Combo->addItem(tr("Rs")); m_c2Combo->addItem(tr("Ls")); m_c2Combo->addItem(tr("Rs")); } if (channels == 6) { m_c1Combo->addItem(tr("LFE")); m_c2Combo->addItem(tr("LFE")); } m_c1Combo->setCurrentIndex(0); if (m_c2Combo->count() > 1) { m_c2Combo->setCurrentIndex(1); } else { m_c2Combo->setCurrentIndex(0); } } void AudioVectorScopeWidget::onNewDisplayImage() { m_mutex.lock(); QPixmap pixmap = QPixmap::fromImage(m_displayImg); m_mutex.unlock(); pixmap = pixmap.scaled(m_imgLabel->width(), m_imgLabel->height(), Qt::KeepAspectRatio); m_imgLabel->setPixmap(pixmap); } void AudioVectorScopeWidget::refreshScope(const QSize &size, bool full) { Q_UNUSED(full) while (m_queue.count() > 0) { m_frame = m_queue.pop(); } qreal side = qMin(size.width(), size.height()); if (m_renderImg.width() != side) { m_renderImg = QImage(QSize(side, side), QImage::Format_ARGB32_Premultiplied); } m_renderImg.fill(Qt::transparent); QPainter p(&m_renderImg); p.setRenderHint(QPainter::Antialiasing, true); // Draw the diagonal axis QPen pen(Qt::DashLine); pen.setColor(palette().text().color().rgb()); pen.setWidth(1); p.setPen(pen); p.drawLine(QPoint(0, 0), QPoint(side, side)); p.drawLine(QPoint(0, side), QPoint(side, 0)); if (m_frame.is_valid() && m_frame.get_audio_samples() > 0) { // Set up the painter for the vector points pen.setStyle(Qt::SolidLine); pen.setWidth(2); p.setPen(pen); // Add a transform to apply rotation QRectF rect = m_renderImg.rect(); QPointF center = rect.center(); QTransform t; t = t.translate(center.x(), center.y()); t = t.rotate(45.0); p.setTransform(t); int channels = m_frame.get_audio_channels(); int c1 = m_c1Index; int c2 = m_c2Index; if (c1 < 0 || c1 >= channels) { c1 = 0; } if (c2 < 0 || c2 >= channels) { c2 = 0; } int samples = m_frame.get_audio_samples(); // Find the max value to be used for scaling const int16_t *a = (int16_t *)m_frame.get_audio(); int16_t maxSampleValue = 0; for (int s = 0; s < samples; s++) { if (std::abs(a[c1]) > maxSampleValue) { maxSampleValue = std::abs(a[c1]); } if (std::abs(a[c2]) > maxSampleValue) { maxSampleValue = std::abs(a[c2]); } a += channels; } a = (int16_t *)m_frame.get_audio(); qreal maxPoint = sqrt(side * side + side * side) / 4; qreal scaleFactor = maxPoint / maxSampleValue; for (int s = 0; s < samples; s++) { QPointF point((qreal)a[c1] * scaleFactor, (qreal)a[c2] * scaleFactor); p.drawPoint(point); a += channels; } } p.end(); m_mutex.lock(); m_displayImg.swap(m_renderImg); m_mutex.unlock(); // Tell the GUI thread that a new image is ready. QMetaObject::invokeMethod(this, "onNewDisplayImage", Qt::QueuedConnection); } QString AudioVectorScopeWidget::getTitle() { return tr("Audio Vector"); }
6,413
C++
.cpp
188
28.132979
92
0.625242
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,256
markercommands.cpp
mltframework_shotcut/src/commands/markercommands.cpp
/* * Copyright (c) 2021 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "markercommands.h" #include <Logger.h> namespace Markers { DeleteCommand::DeleteCommand(MarkersModel &model, const Marker &delMarker, int index) : QUndoCommand(0) , m_model(model) , m_delMarker(delMarker) , m_index(index) { setText(QObject::tr("Delete marker: %1").arg(m_delMarker.text)); } void DeleteCommand::redo() { m_model.doRemove(m_index); } void DeleteCommand::undo() { m_model.doInsert(m_index, m_delMarker); } AppendCommand::AppendCommand(MarkersModel &model, const Marker &newMarker, int index) : QUndoCommand(0) , m_model(model) , m_newMarker(newMarker) , m_index(index) { setText(QObject::tr("Add marker: %1").arg(m_newMarker.text)); } void AppendCommand::redo() { m_model.doAppend(m_newMarker); } void AppendCommand::undo() { m_model.doRemove(m_index); } UpdateCommand::UpdateCommand(MarkersModel &model, const Marker &newMarker, const Marker &oldMarker, int index) : QUndoCommand(0) , m_model(model) , m_newMarker(newMarker) , m_oldMarker(oldMarker) , m_index(index) { if (m_newMarker.text == m_oldMarker.text && m_newMarker.color == m_oldMarker.color) { setText(QObject::tr("Move marker: %1").arg(m_oldMarker.text)); } else { setText(QObject::tr("Edit marker: %1").arg(m_oldMarker.text)); } } void UpdateCommand::redo() { m_model.doUpdate(m_index, m_newMarker); } void UpdateCommand::undo() { m_model.doUpdate(m_index, m_oldMarker); } bool UpdateCommand::mergeWith(const QUndoCommand *other) { const UpdateCommand *that = static_cast<const UpdateCommand *>(other); LOG_DEBUG() << "this index" << m_index << "that index" << that->m_index; if (that->id() != id() || that->m_index != m_index) return false; bool merge = false; if (that->m_newMarker.text == m_oldMarker.text && that->m_newMarker.color == m_oldMarker.color) { // Only start/end change. Merge with previous move command. merge = true; } else if (that->m_newMarker.end == m_oldMarker.end && that->m_newMarker.start == m_oldMarker.start) { // Only text/color change. Merge with previous edit command. merge = true; } if (!merge) return false; m_newMarker = that->m_newMarker; return true; } ClearCommand::ClearCommand(MarkersModel &model, QList<Marker> &clearMarkers) : QUndoCommand(0) , m_model(model) , m_clearMarkers(clearMarkers) { setText(QObject::tr("Clear markers")); } void ClearCommand::redo() { m_model.doClear(); } void ClearCommand::undo() { m_model.doReplace(m_clearMarkers); } } // namespace Markers
3,380
C++
.cpp
109
27.220183
99
0.68654
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
true
false
false
true
false
false
13,257
undohelper.cpp
mltframework_shotcut/src/commands/undohelper.cpp
/* * Copyright (c) 2015-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "undohelper.h" #include "mltcontroller.h" #include "models/audiolevelstask.h" #include "shotcut_mlt_properties.h" #include <Logger.h> #include <QScopedPointer> #include <QUuid> #ifdef UNDOHELPER_DEBUG #define UNDOLOG LOG_DEBUG() #else #define UNDOLOG if (false) LOG_DEBUG() #endif UndoHelper::UndoHelper(MultitrackModel &model) : m_model(model) , m_hints(NoHints) { } void UndoHelper::recordBeforeState() { #ifdef UNDOHELPER_DEBUG debugPrintState("Before state"); #endif m_state.clear(); m_clipsAdded.clear(); m_insertedOrder.clear(); for (int i = 0; i < m_model.trackList().count(); ++i) { int mltIndex = m_model.trackList()[i].mlt_index; QScopedPointer<Mlt::Producer> trackProducer(m_model.tractor()->track(mltIndex)); Mlt::Playlist playlist(*trackProducer); for (int j = 0; j < playlist.count(); ++j) { QScopedPointer<Mlt::Producer> clip(playlist.get_clip(j)); QUuid uid = MLT.ensureHasUuid(clip->parent()); if (clip->is_blank()) { uid = MLT.ensureHasUuid(*clip); } m_insertedOrder << uid; Info &info = m_state[uid]; if (!(m_hints & SkipXML)) info.xml = MLT.XML(&clip->parent()); Mlt::ClipInfo clipInfo; playlist.clip_info(j, &clipInfo); info.frame_in = clipInfo.frame_in; info.frame_out = clipInfo.frame_out; info.oldTrackIndex = i; info.oldClipIndex = j; info.isBlank = playlist.is_blank(j); if (clipInfo.cut && clipInfo.cut->property_exists(kShotcutGroupProperty)) { info.group = clipInfo.cut->get_int(kShotcutGroupProperty); } } } } void UndoHelper::recordAfterState() { #ifdef UNDOHELPER_DEBUG debugPrintState("After state"); #endif QList<QUuid> clipsRemoved = m_state.keys(); m_clipsAdded.clear(); for (int i = 0; i < m_model.trackList().count(); ++i) { int mltIndex = m_model.trackList()[i].mlt_index; QScopedPointer<Mlt::Producer> trackProducer(m_model.tractor()->track(mltIndex)); Mlt::Playlist playlist(*trackProducer); for (int j = 0; j < playlist.count(); ++j) { QScopedPointer<Mlt::Producer> clip(playlist.get_clip(j)); QUuid uid = MLT.ensureHasUuid(clip->parent()); if (clip->is_blank()) { uid = MLT.ensureHasUuid(*clip); } /* Clips not previously in m_state are new */ if (!m_state.contains(uid)) { UNDOLOG << "New clip at" << i << j; m_clipsAdded << uid; m_affectedTracks << i; } else { Info &info = m_state[uid]; info.changes = 0; info.newTrackIndex = i; info.newClipIndex = j; /* Indices have changed; these are moved */ if (info.oldTrackIndex != info.newTrackIndex || info.oldClipIndex != info.newClipIndex) { UNDOLOG << "Clip" << uid << "moved from" << info.oldTrackIndex << info.oldClipIndex << "to" << info.newTrackIndex << info.newClipIndex; info.changes |= Moved; m_affectedTracks << info.oldTrackIndex; m_affectedTracks << info.newTrackIndex; } if (!(m_hints & SkipXML) && !info.isBlank) { QString newXml = MLT.XML(&clip->parent()); if (info.xml != newXml) { UNDOLOG << "Modified xml:" << uid; info.changes |= XMLModified; m_affectedTracks << i; } } Mlt::ClipInfo newInfo; playlist.clip_info(j, &newInfo); /* Only in/out point changes are handled at this time. */ if (info.frame_in != newInfo.frame_in || info.frame_out != newInfo.frame_out) { UNDOLOG << "In/out changed:" << uid; info.changes |= ClipInfoModified; info.in_delta = info.frame_in - newInfo.frame_in; info.out_delta = newInfo.frame_out - info.frame_out; m_affectedTracks << i; } } clipsRemoved.removeOne(uid); } } /* Clips that did not show up are removed from the timeline */ foreach (QUuid uid, clipsRemoved) { UNDOLOG << "Clip removed:" << uid; auto &info = m_state[uid]; info.changes = Removed; m_affectedTracks << info.oldTrackIndex; } } void UndoHelper::undoChanges() { #ifdef UNDOHELPER_DEBUG debugPrintState("Before undo"); #endif if (m_hints & RestoreTracks) { restoreAffectedTracks(); emit m_model.modified(); #ifdef UNDOHELPER_DEBUG debugPrintState("After undo"); #endif return; } QMap<int, int> indexAdjustment; /* We're walking through the list in the order of uids, which is the order in which the * clips were laid out originally. As we go through the clips we make sure the clips behind * the current index are as they were originally before we move on to the next one */ foreach (QUuid uid, m_insertedOrder) { const Info &info = m_state[uid]; UNDOLOG << "Handling uid" << uid << "on track" << info.oldTrackIndex << "index" << info.oldClipIndex; int trackIndex = m_model.trackList()[info.oldTrackIndex].mlt_index; QScopedPointer<Mlt::Producer> trackProducer(m_model.tractor()->track(trackIndex)); Mlt::Playlist playlist(*trackProducer); /* This is the index in the track we're currently restoring */ int currentIndex = qMin(info.oldClipIndex + indexAdjustment[trackIndex], playlist.count() - 1); /* Clips that were moved are simply searched for using the uid, and moved in place. We * do not use the indices directly because they become invalid once the playlist is * modified. */ if (info.changes & Moved) { Q_ASSERT(info.newTrackIndex == info.oldTrackIndex && "cross-track moves are unsupported so far"); int clipCurrentlyAt = -1; for (int i = 0; i < playlist.count(); ++i) { QScopedPointer<Mlt::Producer> clip(playlist.get_clip(i)); if (MLT.uuid(clip->parent()) == uid || MLT.uuid(*clip) == uid) { clipCurrentlyAt = i; break; } } Q_ASSERT(clipCurrentlyAt != -1 && "Moved clip could not be found"); UNDOLOG << "Found clip with uid" << uid << "at index" << clipCurrentlyAt; if (clipCurrentlyAt != info.oldClipIndex && (currentIndex < clipCurrentlyAt || currentIndex > clipCurrentlyAt + 1)) { UNDOLOG << "moving from" << clipCurrentlyAt << "to" << currentIndex; QModelIndex modelIndex = m_model.createIndex(clipCurrentlyAt, 0, info.oldTrackIndex); m_model.beginMoveRows(modelIndex.parent(), clipCurrentlyAt, clipCurrentlyAt, modelIndex.parent(), currentIndex); playlist.move(clipCurrentlyAt, currentIndex); m_model.endMoveRows(); } } /* Removed clips are reinserted using their stored XML */ if (info.changes & Removed) { QModelIndex modelIndex = m_model.createIndex(currentIndex, 0, info.oldTrackIndex); m_model.beginInsertRows(modelIndex.parent(), currentIndex, currentIndex); if (info.isBlank) { playlist.insert_blank(currentIndex, info.frame_out - info.frame_in); UNDOLOG << "inserting isBlank at " << currentIndex; } else { UNDOLOG << "inserting clip at " << currentIndex << uid; Q_ASSERT(!(m_hints & SkipXML) && "Cannot restore clip without stored XML"); Q_ASSERT(!info.xml.isEmpty()); Mlt::Producer restoredClip(MLT.profile(), "xml-string", info.xml.toUtf8().constData()); if (restoredClip.type() == mlt_service_tractor_type) { // transition restoredClip.set("mlt_type", "mlt_producer"); } else { fixTransitions(playlist, currentIndex, restoredClip); } playlist.insert(restoredClip, currentIndex, info.frame_in, info.frame_out); } m_model.endInsertRows(); QScopedPointer<Mlt::Producer> clip(playlist.get_clip(currentIndex)); Q_ASSERT(currentIndex < playlist.count()); Q_ASSERT(!clip.isNull()); if (info.isBlank) { MLT.setUuid(*clip, uid); } else { MLT.setUuid(clip->parent(), uid); } if (info.group >= 0) { clip->set(kShotcutGroupProperty, info.group); } AudioLevelsTask::start(clip->parent(), &m_model, modelIndex); indexAdjustment[trackIndex]++; } /* Only in/out points handled so far */ if (info.changes & ClipInfoModified) { int filterIn = MLT.filterIn(playlist, currentIndex); int filterOut = MLT.filterOut(playlist, currentIndex); QScopedPointer<Mlt::Producer> clip(playlist.get_clip(currentIndex)); if (clip && clip->is_valid()) { UNDOLOG << "resizing clip at" << currentIndex << "in" << info.frame_in << "out" << info.frame_out; if (clip->parent().get_data("mlt_mix")) clip->parent().set("mlt_mix", nullptr, 0); if (clip->get_data("mix_in")) clip->set("mix_in", nullptr, 0); if (clip->get_data("mix_out")) clip->set("mix_out", nullptr, 0); playlist.resize_clip(currentIndex, info.frame_in, info.frame_out); MLT.adjustClipFilters(clip->parent(), filterIn, filterOut, info.in_delta, info.out_delta, info.in_delta); } QModelIndex modelIndex = m_model.createIndex(currentIndex, 0, info.oldTrackIndex); QVector<int> roles; roles << MultitrackModel::InPointRole; roles << MultitrackModel::OutPointRole; roles << MultitrackModel::DurationRole; emit m_model.dataChanged(modelIndex, modelIndex, roles); if (clip && clip->is_valid()) AudioLevelsTask::start(clip->parent(), &m_model, modelIndex); } } /* Finally we walk through the tracks once more, removing clips that * were added, and clearing the temporarily used uid property */ int trackIndex = 0; foreach (const Track &track, m_model.trackList()) { QScopedPointer<Mlt::Producer> trackProducer(m_model.tractor()->track(track.mlt_index)); Mlt::Playlist playlist(*trackProducer); for (int i = playlist.count() - 1; i >= 0; --i) { QScopedPointer<Mlt::Producer> clip(playlist.get_clip(i)); QUuid uid = MLT.uuid(clip->parent()); if (clip->is_blank()) { uid = MLT.uuid(*clip); } if (m_clipsAdded.removeOne(uid)) { UNDOLOG << "Removing clip at" << i; m_model.beginRemoveRows(m_model.index(trackIndex), i, i); if (clip->parent().get_data("mlt_mix")) clip->parent().set("mlt_mix", NULL, 0); if (clip->get_data("mix_in")) clip->set("mix_in", NULL, 0); if (clip->get_data("mix_out")) clip->set("mix_out", NULL, 0); playlist.remove(i); m_model.endRemoveRows(); } } trackIndex++; } emit m_model.modified(); #ifdef UNDOHELPER_DEBUG debugPrintState("After undo"); #endif } void UndoHelper::setHints(OptimizationHints hints) { m_hints = hints; } void UndoHelper::debugPrintState(const QString &title) { LOG_DEBUG() << "timeline state:" << title << "{"; for (int i = 0; i < m_model.trackList().count(); ++i) { int mltIndex = m_model.trackList()[i].mlt_index; QString trackStr = QStringLiteral(" track %1 (mlt-idx %2):").arg(i).arg(mltIndex); QScopedPointer<Mlt::Producer> trackProducer(m_model.tractor()->track(mltIndex)); Mlt::Playlist playlist(*trackProducer); for (int j = 0; j < playlist.count(); ++j) { Mlt::ClipInfo info; playlist.clip_info(j, &info); QUuid uid = MLT.uuid(*info.producer); if (info.producer->is_blank() && info.cut) { uid = MLT.uuid(*info.cut); } trackStr += QStringLiteral(" [ %5 %1 -> %2 (%3 frames) %4]").arg(info.frame_in).arg( info.frame_out).arg( info.frame_count).arg(info.cut->is_blank() ? "blank " : "clip").arg(uid.toString()); } LOG_DEBUG() << qPrintable(trackStr); } LOG_DEBUG() << "}"; } void UndoHelper::restoreAffectedTracks() { // Remove everything in the affected tracks. for (const auto &trackIndex : std::as_const(m_affectedTracks)) { if (trackIndex >= 0 && trackIndex < m_model.trackList().size()) { auto mlt_index = m_model.trackList().at(trackIndex).mlt_index; QScopedPointer<Mlt::Producer> producer(m_model.tractor()->track(mlt_index)); if (producer->is_valid()) { Mlt::Playlist playlist(*producer.data()); m_model.beginRemoveRows(m_model.index(trackIndex), 0, playlist.count() - 1); UNDOLOG << "clearing track" << trackIndex; playlist.clear(); m_model.endRemoveRows(); } } } for (const auto &uid : std::as_const(m_insertedOrder)) { const Info &info = m_state[uid]; if (m_affectedTracks.contains(info.oldTrackIndex)) { UNDOLOG << "Handling uid" << uid << "on track" << info.oldTrackIndex << "index" << info.oldClipIndex; // Clips are restored using their stored XML. int mltIndex = m_model.trackList()[info.oldTrackIndex].mlt_index; QScopedPointer<Mlt::Producer> trackProducer(m_model.tractor()->track(mltIndex)); Mlt::Playlist playlist(*trackProducer); auto currentIndex = playlist.count(); QModelIndex modelIndex = m_model.createIndex(currentIndex, 0, info.oldTrackIndex); m_model.beginInsertRows(modelIndex.parent(), currentIndex, currentIndex); if (info.isBlank) { playlist.blank(info.frame_out - info.frame_in); UNDOLOG << "appending blank at" << currentIndex << info.frame_out << info.frame_in; } else { UNDOLOG << "appending clip at" << currentIndex; Q_ASSERT(!(m_hints & SkipXML) && "Cannot restore clip without stored XML"); Q_ASSERT(!info.xml.isEmpty()); Mlt::Producer restoredClip(MLT.profile(), "xml-string", info.xml.toUtf8().constData()); if (restoredClip.type() == mlt_service_tractor_type) { // transition restoredClip.set("mlt_type", "mlt_producer"); } playlist.append(restoredClip, info.frame_in, info.frame_out); if (info.group >= 0) { QScopedPointer<Mlt::Producer> clip(playlist.get_clip(currentIndex)); clip->set(kShotcutGroupProperty, info.group); } } m_model.endInsertRows(); QScopedPointer<Mlt::Producer> clip(playlist.get_clip(currentIndex)); Q_ASSERT(currentIndex < playlist.count()); Q_ASSERT(!clip.isNull()); if (info.isBlank) { MLT.setUuid(*clip, uid); } else { MLT.setUuid(clip->parent(), uid); } AudioLevelsTask::start(clip->parent(), &m_model, modelIndex); } } for (const auto &trackIndex : std::as_const(m_affectedTracks)) { if (trackIndex >= 0 && trackIndex < m_model.trackList().size()) { auto mlt_index = m_model.trackList().at(trackIndex).mlt_index; QScopedPointer<Mlt::Producer> producer(m_model.tractor()->track(mlt_index)); if (producer->is_valid()) { Mlt::Playlist playlist(*producer.data()); for (auto currentIndex = 0; currentIndex < playlist.count(); currentIndex++) { Mlt::Producer clip = playlist.get_clip(currentIndex); fixTransitions(playlist, currentIndex, clip); } } } } } void UndoHelper::fixTransitions(Mlt::Playlist playlist, int clipIndex, Mlt::Producer clip) { if (clip.is_blank()) { return; } int transitionIndex = 0; for (auto currentIndex : { clipIndex + 1, clipIndex - 1 }) { // Connect a transition on the right/left to the new producer. Mlt::Producer producer(playlist.get_clip(currentIndex)); if (producer.is_valid() && producer.parent().get(kShotcutTransitionProperty)) { Mlt::Tractor transition(producer.parent()); if (transition.is_valid()) { QScopedPointer<Mlt::Producer> transitionClip(transition.track(transitionIndex)); if (transitionClip->is_valid() && transitionClip->parent().get_service() != clip.parent().get_service()) { UNDOLOG << "Fixing transition at clip index" << currentIndex << "transition index" << transitionIndex; transitionClip.reset(clip.cut(transitionClip->get_in(), transitionClip->get_out())); transition.set_track(*transitionClip.data(), transitionIndex); } } } transitionIndex++; } }
18,975
C++
.cpp
404
35.304455
114
0.569125
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
13,258
playlistcommands.cpp
mltframework_shotcut/src/commands/playlistcommands.cpp
/* * Copyright (c) 2013-2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "playlistcommands.h" #include "mltcontroller.h" #include "mainwindow.h" #include <Logger.h> namespace Playlist { AppendCommand::AppendCommand(PlaylistModel &model, const QString &xml, bool emitModified, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_xml(xml) , m_emitModified(emitModified) { setText(QObject::tr("Append playlist item %1").arg(m_model.rowCount() + 1)); } void AppendCommand::redo() { LOG_DEBUG() << ""; Mlt::Producer producer(MLT.profile(), "xml-string", m_xml.toUtf8().constData()); m_model.append(producer, m_emitModified); if (m_uuid.isNull()) { m_uuid = MLT.ensureHasUuid(producer); } else { MLT.setUuid(producer, m_uuid); } } void AppendCommand::undo() { LOG_DEBUG() << ""; m_model.remove(m_model.rowCount() - 1); } InsertCommand::InsertCommand(PlaylistModel &model, const QString &xml, int row, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_xml(xml) , m_row(row) { setText(QObject::tr("Insert playist item %1").arg(row + 1)); } void InsertCommand::redo() { LOG_DEBUG() << "row" << m_row; Mlt::Producer producer(MLT.profile(), "xml-string", m_xml.toUtf8().constData()); m_model.insert(producer, m_row); if (m_uuid.isNull()) { m_uuid = MLT.ensureHasUuid(producer); } else { MLT.setUuid(producer, m_uuid); } } void InsertCommand::undo() { LOG_DEBUG() << "row" << m_row; m_model.remove(m_row); } UpdateCommand::UpdateCommand(PlaylistModel &model, const QString &xml, int row, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_newXml(xml) , m_row(row) { setText(QObject::tr("Update playlist item %1").arg(row + 1)); QScopedPointer<Mlt::ClipInfo> info(m_model.playlist()->clip_info(row)); info->producer->set_in_and_out(info->frame_in, info->frame_out); m_oldXml = MLT.XML(info->producer); } void UpdateCommand::redo() { LOG_DEBUG() << "row" << m_row; Mlt::Producer producer(MLT.profile(), "xml-string", m_newXml.toUtf8().constData()); m_model.update(m_row, producer); if (m_uuid.isNull()) { m_uuid = MLT.ensureHasUuid(producer); } else { MLT.setUuid(producer, m_uuid); } } void UpdateCommand::undo() { LOG_DEBUG() << "row" << m_row; Mlt::Producer producer(MLT.profile(), "xml-string", m_oldXml.toUtf8().constData()); m_model.update(m_row, producer); } bool UpdateCommand::mergeWith(const QUndoCommand *other) { const UpdateCommand *that = static_cast<const UpdateCommand *>(other); LOG_DEBUG() << "this row" << m_row << "that row" << that->m_row; if (that->id() != id() || that->m_row != m_row) return false; m_newXml = that->m_newXml; return true; } RemoveCommand::RemoveCommand(PlaylistModel &model, int row, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_row(row) { QScopedPointer<Mlt::ClipInfo> info(m_model.playlist()->clip_info(row)); info->producer->set_in_and_out(info->frame_in, info->frame_out); m_xml = MLT.XML(info->producer); setText(QObject::tr("Remove playlist item %1").arg(row + 1)); m_uuid = MLT.ensureHasUuid(*info->producer); } void RemoveCommand::redo() { LOG_DEBUG() << "row" << m_row; m_model.remove(m_row); } void RemoveCommand::undo() { LOG_DEBUG() << "row" << m_row; Mlt::Producer producer(MLT.profile(), "xml-string", m_xml.toUtf8().constData()); m_model.insert(producer, m_row); MLT.setUuid(producer, m_uuid); } ClearCommand::ClearCommand(PlaylistModel &model, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) { m_xml = MLT.XML(m_model.playlist()); setText(QObject::tr("Clear playlist")); for (int i = 0; i < m_model.playlist()->count(); i++) { Mlt::Producer clip(m_model.playlist()->get_clip(i)); if (clip.is_valid()) { m_uuids << MLT.ensureHasUuid(clip.parent()); } } } void ClearCommand::redo() { LOG_DEBUG() << ""; m_model.clear(); } void ClearCommand::undo() { LOG_DEBUG() << ""; Mlt::Producer *producer = new Mlt::Producer(MLT.profile(), "xml-string", m_xml.toUtf8().constData()); if (producer->is_valid()) { producer->set("resource", "<playlist>"); if (!MLT.setProducer(producer)) { m_model.load(); for (int i = 0; i < m_model.playlist()->count(); i++) { Mlt::Producer clip(m_model.playlist()->get_clip(i)); if (clip.is_valid() && i < m_uuids.size()) { MLT.setUuid(clip.parent(), m_uuids[i]); } } MLT.pause(); MAIN.seekPlaylist(0); } } else { LOG_ERROR() << "failed to restore playlist from XML"; } } MoveCommand::MoveCommand(PlaylistModel &model, int from, int to, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_from(from) , m_to(to) { setText(QObject::tr("Move item from %1 to %2").arg(from + 1).arg(to + 1)); } void MoveCommand::redo() { LOG_DEBUG() << "from" << m_from << "to" << m_to; m_model.move(m_from, m_to); } void MoveCommand::undo() { LOG_DEBUG() << "from" << m_from << "to" << m_to; m_model.move(m_to, m_from); } SortCommand::SortCommand(PlaylistModel &model, int column, Qt::SortOrder order, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_column(column) , m_order(order) { m_xml = MLT.XML(m_model.playlist()); QString columnName = m_model.headerData(m_column, Qt::Horizontal, Qt::DisplayRole).toString(); setText(QObject::tr("Sort playlist by %1").arg(columnName)); for (int i = 0; i < m_model.playlist()->count(); i++) { Mlt::Producer clip(m_model.playlist()->get_clip(i)); if (clip.is_valid()) { m_uuids << MLT.ensureHasUuid(clip.parent()); } } } void SortCommand::redo() { LOG_DEBUG() << m_column; m_model.sort(m_column, m_order); } void SortCommand::undo() { LOG_DEBUG() << ""; Mlt::Producer *producer = new Mlt::Producer(MLT.profile(), "xml-string", m_xml.toUtf8().constData()); if (producer->is_valid()) { producer->set("resource", "<playlist>"); if (!MLT.setProducer(producer)) { m_model.load(); for (int i = 0; i < m_model.playlist()->count(); i++) { Mlt::Producer clip(m_model.playlist()->get_clip(i)); if (clip.is_valid() && i < m_uuids.size()) { MLT.setUuid(clip.parent(), m_uuids[i]); } } MLT.pause(); MAIN.seekPlaylist(0); } } else { LOG_ERROR() << "failed to restore playlist from XML"; } } TrimClipInCommand::TrimClipInCommand(PlaylistModel &model, int row, int in, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_row(row) , m_oldIn(in) , m_newIn(in) , m_out(-1) { setText(QObject::tr("Trim playlist item %1 in").arg(row + 1)); QScopedPointer<Mlt::ClipInfo> info(m_model.playlist()->clip_info(row)); if (info) { m_oldIn = info->frame_in; m_out = info->frame_out; } } void TrimClipInCommand::redo() { LOG_DEBUG() << "row" << m_row << "in" << m_newIn; m_model.setInOut(m_row, m_newIn, m_out); } void TrimClipInCommand::undo() { LOG_DEBUG() << "row" << m_row << "in" << m_oldIn; m_model.setInOut(m_row, m_oldIn, m_out); } bool TrimClipInCommand::mergeWith(const QUndoCommand *other) { const TrimClipInCommand *that = static_cast<const TrimClipInCommand *>(other); LOG_DEBUG() << "this row" << m_row << "that row" << that->m_row; if (that->id() != id() || that->m_row != m_row) return false; m_newIn = that->m_newIn; return true; } TrimClipOutCommand::TrimClipOutCommand(PlaylistModel &model, int row, int out, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_row(row) , m_in(-1) , m_oldOut(out) , m_newOut(out) { setText(QObject::tr("Trim playlist item %1 out").arg(row + 1)); QScopedPointer<Mlt::ClipInfo> info(m_model.playlist()->clip_info(row)); if (info) { m_in = info->frame_in; m_oldOut = info->frame_out; } } void TrimClipOutCommand::redo() { LOG_DEBUG() << "row" << m_row << "out" << m_newOut; m_model.setInOut(m_row, m_in, m_newOut); } void TrimClipOutCommand::undo() { LOG_DEBUG() << "row" << m_row << "out" << m_oldOut; m_model.setInOut(m_row, m_in, m_oldOut); } bool TrimClipOutCommand::mergeWith(const QUndoCommand *other) { const TrimClipOutCommand *that = static_cast<const TrimClipOutCommand *>(other); LOG_DEBUG() << "this row" << m_row << "that row" << that->m_row; if (that->id() != id() || that->m_row != m_row) return false; m_newOut = that->m_newOut; return true; } ReplaceCommand::ReplaceCommand(PlaylistModel &model, const QString &xml, int row, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_newXml(xml) , m_row(row) { setText(QObject::tr("Replace playlist item %1").arg(row + 1)); QScopedPointer<Mlt::ClipInfo> info(m_model.playlist()->clip_info(row)); info->producer->set_in_and_out(info->frame_in, info->frame_out); m_uuid = MLT.ensureHasUuid(*info->producer); m_oldXml = MLT.XML(info->producer); } void ReplaceCommand::redo() { LOG_DEBUG() << "row" << m_row; Mlt::Producer producer(MLT.profile(), "xml-string", m_newXml.toUtf8().constData()); m_model.update(m_row, producer, true); } void ReplaceCommand::undo() { LOG_DEBUG() << "row" << m_row; Mlt::Producer producer(MLT.profile(), "xml-string", m_oldXml.toUtf8().constData()); m_model.update(m_row, producer, true); MLT.setUuid(producer, m_uuid); } } // namespace Playlist
10,805
C++
.cpp
329
27.580547
100
0.613314
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
13,259
timelinecommands.cpp
mltframework_shotcut/src/commands/timelinecommands.cpp
/* * Copyright (c) 2013-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "dialogs/longuitask.h" #include "timelinecommands.h" #include "mainwindow.h" #include "mltcontroller.h" #include "shotcut_mlt_properties.h" #include "settings.h" #include "proxymanager.h" #include "dialogs/longuitask.h" #include "controllers/filtercontroller.h" #include "qmltypes/qmlmetadata.h" #include "util.h" #include <Logger.h> #include <QMetaObject> namespace Timeline { Mlt::Producer *deserializeProducer(QString &xml) { return new Mlt::Producer(MLT.profile(), "xml-string", xml.toUtf8().constData()); } int getUniqueGroupNumber(MultitrackModel &model) { QSet<int> groups; for (int trackIndex = 0; trackIndex < model.trackList().size(); trackIndex++) { int i = model.trackList().at(trackIndex).mlt_index; QScopedPointer<Mlt::Producer> track(model.tractor()->track(i)); if (track) { Mlt::Playlist playlist(*track); for (int clipIndex = 0; clipIndex < playlist.count(); clipIndex++) { QScopedPointer<Mlt::ClipInfo> info(playlist.clip_info(clipIndex)); if (info && info->cut && info->cut->property_exists(kShotcutGroupProperty)) { groups.insert(info->cut->get_int(kShotcutGroupProperty)); } } } } static const int MAX_GROUPS = 5000; for (int i = 0; i < MAX_GROUPS; i++) { if (!groups.contains(i)) { return i; } } LOG_ERROR() << "More than" << MAX_GROUPS << "groups!"; return 0; } AppendCommand::AppendCommand(MultitrackModel &model, int trackIndex, const QString &xml, bool skipProxy, bool seek, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_trackIndex(qBound(0, trackIndex, qMax(model.rowCount() - 1, 0))) , m_xml(xml) , m_undoHelper(m_model) , m_skipProxy(skipProxy) , m_seek(seek) { setText(QObject::tr("Append to track")); } void AppendCommand::redo() { LOG_DEBUG() << "trackIndex" << m_trackIndex; LongUiTask longTask(QObject::tr("Append to Timeline")); m_undoHelper.recordBeforeState(); Mlt::Producer *producer = longTask.runAsync<Mlt::Producer *>(QObject::tr("Preparing"), [ = ]() { return deserializeProducer(m_xml); }); if (producer->type() == mlt_service_playlist_type) { Mlt::Playlist playlist(*producer); int count = playlist.count(); for (int i = 0; i < count; i++) { longTask.reportProgress(QObject::tr("Appending"), i, count); QScopedPointer<Mlt::ClipInfo> info(playlist.clip_info(i)); Mlt::Producer clip = Mlt::Producer(info->producer); if (!m_skipProxy) ProxyManager::generateIfNotExists(clip); clip.set_in_and_out(info->frame_in, info->frame_out); bool lastClip = i == (count - 1); m_model.appendClip(m_trackIndex, clip, false, lastClip); } } else { if (!m_skipProxy) ProxyManager::generateIfNotExists(*producer); m_model.appendClip(m_trackIndex, *producer, m_seek); } longTask.reportProgress(QObject::tr("Finishing"), 0, 0); delete producer; m_undoHelper.recordAfterState(); } void AppendCommand::undo() { LOG_DEBUG() << "trackIndex" << m_trackIndex; m_undoHelper.undoChanges(); } InsertCommand::InsertCommand(MultitrackModel &model, MarkersModel &markersModel, int trackIndex, int position, const QString &xml, bool seek, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_markersModel(markersModel) , m_trackIndex(qBound(0, trackIndex, qMax(model.rowCount() - 1, 0))) , m_position(position) , m_xml(xml) , m_undoHelper(m_model) , m_seek(seek) , m_rippleAllTracks(Settings.timelineRippleAllTracks()) , m_rippleMarkers(Settings.timelineRippleMarkers()) , m_markersShift(0) { setText(QObject::tr("Insert into track")); m_undoHelper.setHints(UndoHelper::RestoreTracks); } void InsertCommand::redo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "position" << m_position; int shift = 0; m_undoHelper.recordBeforeState(); Mlt::Producer clip(MLT.profile(), "xml-string", m_xml.toUtf8().constData()); if (clip.type() == mlt_service_playlist_type) { LongUiTask longTask(QObject::tr("Add Files")); Mlt::Playlist playlist(clip); int n = playlist.count(); int i = n; while (i--) { QScopedPointer<Mlt::ClipInfo> info(playlist.clip_info(i)); clip = Mlt::Producer(info->producer); longTask.reportProgress(QFileInfo(ProxyManager::resource(clip)).fileName(), n - i - 1, n); ProxyManager::generateIfNotExists(clip); clip.set_in_and_out(info->frame_in, info->frame_out); bool lastClip = i == 0; m_model.insertClip(m_trackIndex, clip, m_position, m_rippleAllTracks, false, lastClip); shift += info->frame_count; } } else { shift = clip.get_playtime(); ProxyManager::generateIfNotExists(clip); m_model.insertClip(m_trackIndex, clip, m_position, m_rippleAllTracks, m_seek); } m_undoHelper.recordAfterState(); if (m_rippleMarkers && shift > 0) { m_markersShift = shift; m_markersModel.doShift(m_position, m_markersShift); } } void InsertCommand::undo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "position" << m_position; m_undoHelper.undoChanges(); if (m_rippleMarkers && m_markersShift > 0) { m_markersModel.doShift(m_position + m_markersShift, -m_markersShift); } } OverwriteCommand::OverwriteCommand(MultitrackModel &model, int trackIndex, int position, const QString &xml, bool seek, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_trackIndex(qBound(0, trackIndex, qMax(model.rowCount() - 1, 0))) , m_position(position) , m_xml(xml) , m_undoHelper(m_model) , m_seek(seek) { setText(QObject::tr("Overwrite onto track")); m_undoHelper.setHints(UndoHelper::RestoreTracks); } void OverwriteCommand::redo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "position" << m_position; m_undoHelper.recordBeforeState(); Mlt::Producer clip(MLT.profile(), "xml-string", m_xml.toUtf8().constData()); if (clip.type() == mlt_service_playlist_type) { LongUiTask longTask(QObject::tr("Add Files")); Mlt::Playlist playlist(clip); int position = m_position; int n = playlist.count(); for (int i = 0; i < n; i++) { QScopedPointer<Mlt::ClipInfo> info(playlist.clip_info(i)); clip = Mlt::Producer(info->producer); longTask.reportProgress(QFileInfo(ProxyManager::resource(clip)).fileName(), i, n); ProxyManager::generateIfNotExists(clip); clip.set_in_and_out(info->frame_in, info->frame_out); bool lastClip = i == (n - 1); m_model.overwrite(m_trackIndex, clip, position, false, lastClip); position += info->frame_count; } } else { ProxyManager::generateIfNotExists(clip); m_model.overwrite(m_trackIndex, clip, m_position, m_seek); } m_undoHelper.recordAfterState(); } void OverwriteCommand::undo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "position" << m_position; m_undoHelper.undoChanges(); } LiftCommand::LiftCommand(MultitrackModel &model, int trackIndex, int clipIndex, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_trackIndex(qBound(0, trackIndex, qMax(model.rowCount() - 1, 0))) , m_clipIndex(clipIndex) , m_undoHelper(m_model) { setText(QObject::tr("Lift from track")); m_undoHelper.setHints(UndoHelper::RestoreTracks); } void LiftCommand::redo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex; m_undoHelper.recordBeforeState(); m_model.liftClip(m_trackIndex, m_clipIndex); m_undoHelper.recordAfterState(); } void LiftCommand::undo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex; m_undoHelper.undoChanges(); } RemoveCommand::RemoveCommand(MultitrackModel &model, MarkersModel &markersModel, int trackIndex, int clipIndex, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_markersModel(markersModel) , m_trackIndex(qBound(0, trackIndex, qMax(model.rowCount() - 1, 0))) , m_clipIndex(clipIndex) , m_undoHelper(m_model) , m_rippleAllTracks(Settings.timelineRippleAllTracks()) , m_rippleMarkers(Settings.timelineRippleMarkers()) , m_markerRemoveStart(-1) , m_markerRemoveEnd(-1) { setText(QObject::tr("Remove from track")); m_undoHelper.setHints(UndoHelper::RestoreTracks); } void RemoveCommand::redo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex; if (m_rippleMarkers) { // Remove and shift markers as appropriate bool markersModified = false; m_markers = m_markersModel.getMarkers(); if (m_markers.size() > 0) { auto mlt_index = m_model.trackList().at(m_trackIndex).mlt_index; QScopedPointer<Mlt::Producer> track(m_model.tractor()->track(mlt_index)); if (track && track->is_valid()) { Mlt::Playlist playlist(*track); m_markerRemoveStart = playlist.clip_start(m_clipIndex); m_markerRemoveEnd = m_markerRemoveStart + playlist.clip_length(m_clipIndex) - 1; } } if (m_markers.size() > 0 && m_markerRemoveStart >= 0) { QList<Markers::Marker> newMarkers = m_markers; for (int i = 0; i < newMarkers.size(); i++) { Markers::Marker &marker = newMarkers[i]; if (marker.start >= m_markerRemoveStart && marker.start <= m_markerRemoveEnd) { // This marker is in the removed segment. Remove it newMarkers.removeAt(i); i--; markersModified = true; } else if (marker.start > m_markerRemoveEnd) { // This marker is after the removed segment. Shift it left marker.start -= m_markerRemoveEnd - m_markerRemoveStart; marker.end -= m_markerRemoveEnd - m_markerRemoveStart; markersModified = true; } } if (markersModified) { m_markersModel.doReplace(newMarkers); } } if (!markersModified) { m_markerRemoveStart = -1; m_markers.clear(); } } m_undoHelper.recordBeforeState(); m_model.removeClip(m_trackIndex, m_clipIndex, m_rippleAllTracks); m_undoHelper.recordAfterState(); } void RemoveCommand::undo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex; m_undoHelper.undoChanges(); if (m_rippleMarkers && m_markerRemoveStart >= 0) { m_markersModel.doReplace(m_markers); } } GroupCommand::GroupCommand(MultitrackModel &model, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) { } void GroupCommand::addToGroup(int trackIndex, int clipIndex) { auto clipInfo = m_model.getClipInfo(trackIndex, clipIndex); if (clipInfo && clipInfo->cut && !clipInfo->cut->is_blank()) { ClipPosition position(trackIndex, clipIndex); m_clips.append(position); if (clipInfo->cut->property_exists(kShotcutGroupProperty)) { m_prevGroups.insert(position, clipInfo->cut->get_int(kShotcutGroupProperty)); } } } void GroupCommand::redo() { int groupNumber = getUniqueGroupNumber(m_model); setText(QObject::tr("Group %n clips", nullptr, m_clips.size())); for (auto &clip : m_clips) { auto clipInfo = m_model.getClipInfo(clip.trackIndex, clip.clipIndex); if (clipInfo && clipInfo->cut) { clipInfo->cut->set(kShotcutGroupProperty, groupNumber); QModelIndex modelIndex = m_model.index(clip.clipIndex, 0, m_model.index(clip.trackIndex)); emit m_model.dataChanged(modelIndex, modelIndex, QVector<int>() << MultitrackModel::GroupRole); } } } void GroupCommand::undo() { for (auto &clip : m_clips) { auto clipInfo = m_model.getClipInfo(clip.trackIndex, clip.clipIndex); if (clipInfo && clipInfo->cut) { if (m_prevGroups.contains(clip)) { clipInfo->cut->set(kShotcutGroupProperty, m_prevGroups[clip]); } else { clipInfo->cut->Mlt::Properties::clear(kShotcutGroupProperty); } QModelIndex modelIndex = m_model.index(clip.clipIndex, 0, m_model.index(clip.trackIndex)); emit m_model.dataChanged(modelIndex, modelIndex, QVector<int>() << MultitrackModel::GroupRole); } } } UngroupCommand::UngroupCommand(MultitrackModel &model, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) { } void UngroupCommand::removeFromGroup(int trackIndex, int clipIndex) { auto clipInfo = m_model.getClipInfo(trackIndex, clipIndex); if (clipInfo && clipInfo->cut) { ClipPosition position(trackIndex, clipIndex); if (clipInfo->cut->property_exists(kShotcutGroupProperty)) { m_prevGroups.insert(position, clipInfo->cut->get_int(kShotcutGroupProperty)); } } } void UngroupCommand::redo() { setText(QObject::tr("Ungroup %n clips", nullptr, m_prevGroups.size())); for (auto &clip : m_prevGroups.keys()) { auto clipInfo = m_model.getClipInfo(clip.trackIndex, clip.clipIndex); if (clipInfo && clipInfo->cut) { clipInfo->cut->Mlt::Properties::clear(kShotcutGroupProperty); QModelIndex modelIndex = m_model.index(clip.clipIndex, 0, m_model.index(clip.trackIndex)); emit m_model.dataChanged(modelIndex, modelIndex, QVector<int>() << MultitrackModel::GroupRole); } } } void UngroupCommand::undo() { for (auto &clip : m_prevGroups.keys()) { auto clipInfo = m_model.getClipInfo(clip.trackIndex, clip.clipIndex); if (clipInfo && clipInfo->cut) { clipInfo->cut->set(kShotcutGroupProperty, m_prevGroups[clip]); QModelIndex modelIndex = m_model.index(clip.clipIndex, 0, m_model.index(clip.trackIndex)); emit m_model.dataChanged(modelIndex, modelIndex, QVector<int>() << MultitrackModel::GroupRole); } } } NameTrackCommand::NameTrackCommand(MultitrackModel &model, int trackIndex, const QString &name, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_trackIndex(qBound(0, trackIndex, qMax(model.rowCount() - 1, 0))) , m_name(name) , m_oldName(model.data(m_model.index(trackIndex), MultitrackModel::NameRole).toString()) { setText(QObject::tr("Change track name")); } void NameTrackCommand::redo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "name" << m_name; m_model.setTrackName(m_trackIndex, m_name); } void NameTrackCommand::undo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "name" << m_name; m_model.setTrackName(m_trackIndex, m_oldName); } MergeCommand::MergeCommand(MultitrackModel &model, int trackIndex, int clipIndex, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_trackIndex(qBound(0, trackIndex, qMax(model.rowCount() - 1, 0))) , m_clipIndex(clipIndex) , m_undoHelper(m_model) { setText(QObject::tr("Merge adjacent clips")); } void MergeCommand::redo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipindex" << m_clipIndex; m_undoHelper.recordBeforeState(); m_model.mergeClipWithNext(m_trackIndex, m_clipIndex, false); m_undoHelper.recordAfterState(); } void MergeCommand::undo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipindex" << m_clipIndex; m_undoHelper.undoChanges(); } MuteTrackCommand::MuteTrackCommand(MultitrackModel &model, int trackIndex, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_trackIndex(qBound(0, trackIndex, qMax(model.rowCount() - 1, 0))) , m_oldValue(model.data(m_model.index(trackIndex), MultitrackModel::IsMuteRole).toBool()) { setText(QObject::tr("Toggle track mute")); } void MuteTrackCommand::redo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "mute" << !m_oldValue; m_model.setTrackMute(m_trackIndex, !m_oldValue); } void MuteTrackCommand::undo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "mute" << !m_oldValue; m_model.setTrackMute(m_trackIndex, m_oldValue); } HideTrackCommand::HideTrackCommand(MultitrackModel &model, int trackIndex, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_trackIndex(qBound(0, trackIndex, qMax(model.rowCount() - 1, 0))) , m_oldValue(model.data(m_model.index(trackIndex), MultitrackModel::IsHiddenRole).toBool()) { setText(QObject::tr("Toggle track hidden")); } void HideTrackCommand::redo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "hide" << !m_oldValue; m_model.setTrackHidden(m_trackIndex, !m_oldValue); } void HideTrackCommand::undo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "hide" << !m_oldValue; m_model.setTrackHidden(m_trackIndex, m_oldValue); } CompositeTrackCommand::CompositeTrackCommand(MultitrackModel &model, int trackIndex, bool value, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_trackIndex(qBound(0, trackIndex, qMax(model.rowCount() - 1, 0))) , m_value(value) , m_oldValue(model.data(m_model.index(trackIndex), MultitrackModel::IsCompositeRole).toBool()) { setText(QObject::tr("Change track compositing")); } void CompositeTrackCommand::redo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "composite" << m_value; m_model.setTrackComposite(m_trackIndex, m_value); } void CompositeTrackCommand::undo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "composite" << m_value; m_model.setTrackComposite(m_trackIndex, m_oldValue); } LockTrackCommand::LockTrackCommand(MultitrackModel &model, int trackIndex, bool value, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_trackIndex(qBound(0, trackIndex, qMax(model.rowCount() - 1, 0))) , m_value(value) , m_oldValue(model.data(m_model.index(trackIndex), MultitrackModel::IsLockedRole).toBool()) { setText(QObject::tr("Lock track")); } void LockTrackCommand::redo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "lock" << m_value; m_model.setTrackLock(m_trackIndex, m_value); } void LockTrackCommand::undo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "lock" << m_value; m_model.setTrackLock(m_trackIndex, m_oldValue); } MoveClipCommand::MoveClipCommand(TimelineDock &timeline, int trackDelta, int positionDelta, bool ripple, QUndoCommand *parent) : QUndoCommand(parent) , m_timeline(timeline) , m_model(*timeline.model()) , m_markersModel(*timeline.markersModel()) , m_trackDelta(trackDelta) , m_positionDelta(positionDelta) , m_ripple(ripple) , m_rippleAllTracks(Settings.timelineRippleAllTracks()) , m_rippleMarkers(Settings.timelineRippleMarkers()) , m_undoHelper(m_model) , m_redo(false) , m_earliestStart(-1) { m_undoHelper.setHints(UndoHelper::RestoreTracks); m_undoHelper.recordBeforeState(); } void MoveClipCommand::addClip(int trackIndex, int clipIndex) { auto info = m_model.getClipInfo(trackIndex, clipIndex); if (info && info->cut) { Info saveInfo; saveInfo.trackIndex = trackIndex; saveInfo.clipIndex = clipIndex; saveInfo.frame_in = info->frame_in; saveInfo.frame_out = info->frame_out; saveInfo.start = info->start; if (m_earliestStart == -1 || saveInfo.start < m_earliestStart) { m_earliestStart = saveInfo.start; } if (info->cut->property_exists(kShotcutGroupProperty)) { saveInfo.group = info->cut->get_int(kShotcutGroupProperty); } saveInfo.uuid = MLT.ensureHasUuid(*info->producer); m_clips.insert(saveInfo.start, saveInfo); } } void MoveClipCommand::redo() { LOG_DEBUG() << "track delta" << m_trackDelta << "position delta" << m_positionDelta; if (!m_redo) { if (m_clips.size() > 1) setText(QObject::tr("Move %n timeline clips", nullptr, m_clips.size())); else setText(QObject::tr("Move timeline clip")); } QList<QPoint> selection; if (!m_trackDelta && m_clips.size() == 1) { auto trackIndex = m_clips.first().trackIndex; auto mlt_index = m_model.trackList().at(trackIndex).mlt_index; QScopedPointer<Mlt::Producer> track(m_model.tractor()->track(mlt_index)); if (track) { Mlt::Playlist playlist(*track); int newStart = m_clips.first().start + m_positionDelta; auto targetIndex = playlist.get_clip_index_at(newStart); auto clipIndex = m_clips.first().clipIndex; if (targetIndex >= clipIndex || // pushing clips on same track // pulling clips on same track (playlist.is_blank_at(newStart) && targetIndex == clipIndex - 1)) { bool done = true; if (targetIndex == clipIndex && m_model.isTransition(playlist, clipIndex - 1)) { // Increase duration of transition m_model.trimTransitionOut(trackIndex, clipIndex, m_positionDelta, true); if (!m_ripple) m_model.trimClipIn(trackIndex, clipIndex + 1, m_positionDelta, true, false); } else if (m_ripple) { // Push or pull clips on the same track m_model.moveClip(trackIndex, trackIndex, clipIndex, newStart, m_ripple, m_rippleAllTracks); } else if (m_model.isTransition(playlist, clipIndex + 1)) { // Increase duration of transition m_model.trimTransitionIn(trackIndex, clipIndex, -m_positionDelta, true); m_model.trimClipOut(trackIndex, clipIndex - 1, -m_positionDelta, true, false); } else { done = false; } if (done) { if (!m_redo) { m_redo = true; m_undoHelper.recordAfterState(); } redoMarkers(); selection = m_timeline.uuidsToSelection(QVector<QUuid>() << m_clips.first().uuid); m_timeline.setSelection(selection); return; } } } } QVector<Mlt::Producer> producers; QVector<QUuid> uuids; // First, save each clip and uuid for (auto &clip : m_clips) { uuids.append(clip.uuid); auto info = m_model.getClipInfo(clip.trackIndex, clip.clipIndex); if (info && info->producer && info->producer->is_valid() && info->cut) { producers.append(info->producer); } else { LOG_ERROR() << "Unable to find clip to move" << clip.trackIndex << clip.clipIndex; return; } } // Next, remove each clip for (auto &clip : m_clips) { // Need to look up each one by UUID because indexes will change as clips are removed and // some clips may be removed due to ripple. int trackIndex, clipIndex; auto info = m_model.findClipByUuid(clip.uuid, trackIndex, clipIndex); if (info && info->producer && info->producer->is_valid() && info->cut) { if (m_ripple) m_model.removeClip(trackIndex, clipIndex, m_rippleAllTracks); else m_model.liftClip(trackIndex, clipIndex); } else { // This can happen with ripple since a clip my be removed due to ripple if (!m_ripple) { LOG_ERROR() << "Unable to find clip to move" << trackIndex << clipIndex; return; } } } // Finally, place each clip in the new location for (auto &clip : m_clips) { if (producers.size() == 0) { LOG_ERROR() << "Missing producer in move command" << clip.trackIndex << clip.clipIndex; return; } Mlt::Producer &producer = producers.front(); int newTrackIndex = qBound(0, clip.trackIndex + m_trackDelta, qMax(int(m_model.trackList().size()) - 1, 0)); int newStart = clip.start + m_positionDelta; producer.set_in_and_out(clip.frame_in, clip.frame_out); if (newStart + producer.get_playtime() >= 0) { if (m_ripple) m_model.insertClip(newTrackIndex, producer, newStart, m_rippleAllTracks); else m_model.overwrite(newTrackIndex, producer, newStart, false); int newClipIndex = m_model.clipIndex(newTrackIndex, newStart); auto clipInfo = m_model.getClipInfo(newTrackIndex, newClipIndex); if (clipInfo && clipInfo->cut) { if (clip.group >= 0) { clipInfo->cut->set(kShotcutGroupProperty, clip.group); QModelIndex modelIndex = m_model.index(newClipIndex, 0, m_model.index(newTrackIndex)); emit m_model.dataChanged(modelIndex, modelIndex, QVector<int>() << MultitrackModel::GroupRole); } MLT.setUuid(*clipInfo->producer, clip.uuid); uuids << clip.uuid; } } producers.pop_front(); } if (!m_redo) { m_redo = true; m_undoHelper.recordAfterState(); } redoMarkers(); selection = m_timeline.uuidsToSelection(uuids); m_timeline.setSelection(selection); } void MoveClipCommand::undo() { LOG_DEBUG() << "track delta" << m_trackDelta; m_undoHelper.undoChanges(); if (m_rippleMarkers && m_markers.size() >= 0) { m_markersModel.doReplace(m_markers); } // Select the original clips after undo. QList<QPoint> selection; for (auto &clip : m_clips) { selection << QPoint(clip.clipIndex, clip.trackIndex); } m_timeline.setSelection(selection); } bool MoveClipCommand::mergeWith(const QUndoCommand *other) { const MoveClipCommand *that = static_cast<const MoveClipCommand *>(other); LOG_DEBUG() << "this delta" << m_positionDelta << "that delta" << that->m_positionDelta; if (that->id() != id() || that->m_clips.size() != m_clips.size() || that->m_ripple != m_ripple || that->m_rippleAllTracks != m_rippleAllTracks || that->m_rippleMarkers != m_rippleMarkers) return false; if (that->m_undoHelper.affectedTracks() != m_undoHelper.affectedTracks()) { return false; } auto thisIterator = m_clips.begin(); auto thatIterator = that->m_clips.begin(); while (thisIterator != m_clips.end() && thatIterator != that->m_clips.end()) { if (thisIterator.value().uuid != thatIterator.value().uuid) return false; thisIterator++; thatIterator++; } return true; } void MoveClipCommand::redoMarkers() { if (m_rippleMarkers) { if (m_markers.size() == 0) { m_markers = m_markersModel.getMarkers(); } QList<Markers::Marker> newMarkers = m_markers; bool markersModified = false; for (int i = 0; i < newMarkers.size(); i++) { Markers::Marker &marker = newMarkers[i]; if (marker.start < m_earliestStart && marker.start > (m_earliestStart + m_positionDelta)) { // This marker is in the overwritten segment. Remove it newMarkers.removeAt(i); i--; markersModified = true; } else if (marker.start >= m_earliestStart) { // This marker is after the start of the moved segment. Shift it with the move marker.start += m_positionDelta; marker.end += m_positionDelta; markersModified = true; } } if (markersModified) { m_markersModel.doReplace(newMarkers); } else { m_markers.clear(); } } } TrimClipInCommand::TrimClipInCommand(MultitrackModel &model, MarkersModel &markersModel, int trackIndex, int clipIndex, int delta, bool ripple, bool redo, QUndoCommand *parent) : TrimCommand(parent) , m_model(model) , m_markersModel(markersModel) , m_trackIndex(qBound(0, trackIndex, qMax(model.rowCount() - 1, 0))) , m_clipIndex(clipIndex) , m_delta(delta) , m_ripple(ripple) , m_rippleAllTracks(Settings.timelineRippleAllTracks()) , m_rippleMarkers(Settings.timelineRippleMarkers() && m_ripple) , m_redo(redo) { setText(QObject::tr("Trim clip in point")); } void TrimClipInCommand::redo() { if (m_rippleMarkers) { // Remove and shift markers as appropriate bool markersModified = false; m_markers = m_markersModel.getMarkers(); if (m_markers.size() > 0) { auto mlt_index = m_model.trackList().at(m_trackIndex).mlt_index; QScopedPointer<Mlt::Producer> track(m_model.tractor()->track(mlt_index)); if (track && track->is_valid()) { Mlt::Playlist playlist(*track); m_markerRemoveStart = playlist.clip_start(m_clipIndex); m_markerRemoveEnd = m_markerRemoveStart + m_delta; } } if (m_markers.size() > 0 && m_markerRemoveStart >= 0) { QList<Markers::Marker> newMarkers = m_markers; for (int i = 0; i < newMarkers.size(); i++) { Markers::Marker &marker = newMarkers[i]; if (marker.start >= m_markerRemoveStart && marker.start <= m_markerRemoveEnd) { // This marker is in the removed segment. Remove it newMarkers.removeAt(i); i--; markersModified = true; } else if (marker.start > m_markerRemoveEnd) { // This marker is after the removed segment. Shift it left marker.start -= m_markerRemoveEnd - m_markerRemoveStart; marker.end -= m_markerRemoveEnd - m_markerRemoveStart; markersModified = true; } } if (markersModified) { m_markersModel.doReplace(newMarkers); } } if (!markersModified) { m_markerRemoveStart = -1; m_markers.clear(); } } if (m_redo) { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex << "delta" << m_delta; m_undoHelper.reset(new UndoHelper(m_model)); if (m_ripple) { m_undoHelper->setHints(UndoHelper::SkipXML); } else { m_undoHelper->setHints(UndoHelper::RestoreTracks); } m_undoHelper->recordBeforeState(); m_model.trimClipIn(m_trackIndex, m_clipIndex, m_delta, m_ripple, m_rippleAllTracks); m_undoHelper->recordAfterState(); } else { Q_ASSERT(m_undoHelper); m_undoHelper->recordAfterState(); m_redo = true; } } void TrimClipInCommand::undo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex << "delta" << m_delta; Q_ASSERT(m_undoHelper); m_undoHelper->undoChanges(); if (m_rippleMarkers && m_markerRemoveStart >= 0) { m_markersModel.doReplace(m_markers); } } bool TrimClipInCommand::mergeWith(const QUndoCommand *other) { const TrimClipInCommand *that = static_cast<const TrimClipInCommand *>(other); LOG_DEBUG() << "this clipIndex" << m_clipIndex << "that clipIndex" << that->m_clipIndex; if (that->id() != id() || that->m_trackIndex != m_trackIndex || that->m_clipIndex != m_clipIndex || that->m_ripple != m_ripple || that->m_rippleAllTracks != m_rippleAllTracks || that->m_rippleMarkers != m_rippleMarkers) return false; Q_ASSERT(m_undoHelper); m_undoHelper->recordAfterState(); m_delta += static_cast<const TrimClipInCommand *>(other)->m_delta; return true; } TrimClipOutCommand::TrimClipOutCommand(MultitrackModel &model, MarkersModel &markersModel, int trackIndex, int clipIndex, int delta, bool ripple, bool redo, QUndoCommand *parent) : TrimCommand(parent) , m_model(model) , m_markersModel(markersModel) , m_trackIndex(qBound(0, trackIndex, qMax(model.rowCount() - 1, 0))) , m_clipIndex(clipIndex) , m_delta(delta) , m_ripple(ripple) , m_rippleAllTracks(Settings.timelineRippleAllTracks()) , m_rippleMarkers(Settings.timelineRippleMarkers() && m_ripple) , m_redo(redo) { setText(QObject::tr("Trim clip out point")); } void TrimClipOutCommand::redo() { if (m_rippleMarkers) { // Remove and shift markers as appropriate bool markersModified = false; m_markers = m_markersModel.getMarkers(); if (m_markers.size() > 0) { auto mlt_index = m_model.trackList().at(m_trackIndex).mlt_index; QScopedPointer<Mlt::Producer> track(m_model.tractor()->track(mlt_index)); if (track && track->is_valid()) { Mlt::Playlist playlist(*track); m_markerRemoveStart = playlist.clip_start(m_clipIndex) + playlist.clip_length( m_clipIndex) - m_delta; if (!m_redo) { // For the first redo, the clip has already been trimmed by the timeline dock. // So remove the delta that has already been applied m_markerRemoveStart += m_delta; } m_markerRemoveEnd = m_markerRemoveStart + m_delta; } } if (m_markers.size() > 0 && m_markerRemoveStart >= 0) { QList<Markers::Marker> newMarkers = m_markers; for (int i = 0; i < newMarkers.size(); i++) { Markers::Marker &marker = newMarkers[i]; if (marker.start >= m_markerRemoveStart && marker.start < m_markerRemoveEnd) { // This marker is in the removed segment. Remove it newMarkers.removeAt(i); i--; markersModified = true; } else if (marker.start >= m_markerRemoveEnd) { // This marker is after the removed segment. Shift it left marker.start -= m_markerRemoveEnd - m_markerRemoveStart; marker.end -= m_markerRemoveEnd - m_markerRemoveStart; markersModified = true; } } if (markersModified) { m_markersModel.doReplace(newMarkers); } } if (!markersModified) { m_markerRemoveStart = -1; m_markers.clear(); } } if (m_redo) { m_undoHelper.reset(new UndoHelper(m_model)); if (!m_ripple) m_undoHelper->setHints(UndoHelper::SkipXML); m_undoHelper->recordBeforeState(); m_clipIndex = m_model.trimClipOut(m_trackIndex, m_clipIndex, m_delta, m_ripple, m_rippleAllTracks); m_undoHelper->recordAfterState(); } else { Q_ASSERT(m_undoHelper); m_undoHelper->recordAfterState(); m_redo = true; } } void TrimClipOutCommand::undo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex << "delta" << m_delta; Q_ASSERT(m_undoHelper); m_undoHelper->undoChanges(); if (m_rippleMarkers && m_markerRemoveStart >= 0) { m_markersModel.doReplace(m_markers); } } bool TrimClipOutCommand::mergeWith(const QUndoCommand *other) { const TrimClipOutCommand *that = static_cast<const TrimClipOutCommand *>(other); if (that->id() != id() || that->m_trackIndex != m_trackIndex || that->m_clipIndex != m_clipIndex || that->m_ripple != m_ripple || that->m_rippleAllTracks != m_rippleAllTracks || that->m_rippleMarkers != m_rippleMarkers) return false; Q_ASSERT(m_undoHelper); m_undoHelper->recordAfterState(); m_delta += static_cast<const TrimClipOutCommand *>(other)->m_delta; return true; } SplitCommand::SplitCommand(MultitrackModel &model, const std::vector<int> &trackIndex, const std::vector<int> &clipIndex, int position, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_trackIndex(trackIndex) , m_clipIndex(clipIndex) , m_position(position) , m_undoHelper(m_model) { if (m_clipIndex.size() == 1) { setText(QObject::tr("Split clip")); } else { setText(QObject::tr("Split clips")); } m_undoHelper.setHints(UndoHelper::RestoreTracks); } void SplitCommand::redo() { LOG_DEBUG() << "trackIndex" << m_trackIndex[0] << "clipIndex" << m_clipIndex[0] << "position" << m_position; m_undoHelper.recordBeforeState(); for (int i = 0; i < m_trackIndex.size(); i++) { m_model.splitClip(m_trackIndex[i], m_clipIndex[i], m_position); } m_undoHelper.recordAfterState(); } void SplitCommand::undo() { LOG_DEBUG() << "trackIndex" << m_trackIndex[0] << "clipIndex" << m_clipIndex[0] << "position" << m_position; m_undoHelper.undoChanges(); } FadeInCommand::FadeInCommand(MultitrackModel &model, int trackIndex, int clipIndex, int duration, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_trackIndex(qBound(0, trackIndex, qMax(model.rowCount() - 1, 0))) , m_clipIndex(clipIndex) , m_duration(qMax(duration, 0)) { QModelIndex modelIndex = m_model.index(clipIndex, 0, m_model.index(trackIndex)); m_previous = model.data(modelIndex, MultitrackModel::FadeInRole).toInt(); setText(QObject::tr("Adjust fade in")); } void FadeInCommand::redo() { m_model.fadeIn(m_trackIndex, m_clipIndex, m_duration); } void FadeInCommand::undo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex << "duration" << m_duration; m_model.fadeIn(m_trackIndex, m_clipIndex, m_previous); } bool FadeInCommand::mergeWith(const QUndoCommand *other) { const FadeInCommand *that = static_cast<const FadeInCommand *>(other); if (that->id() != id() || that->m_trackIndex != m_trackIndex || that->m_clipIndex != m_clipIndex || (!that->m_duration && m_duration != that->m_duration)) return false; m_duration = static_cast<const FadeInCommand *>(other)->m_duration; return true; } FadeOutCommand::FadeOutCommand(MultitrackModel &model, int trackIndex, int clipIndex, int duration, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_trackIndex(qBound(0, trackIndex, qMax(model.rowCount() - 1, 0))) , m_clipIndex(clipIndex) , m_duration(qMax(duration, 0)) { QModelIndex modelIndex = m_model.index(clipIndex, 0, m_model.index(trackIndex)); m_previous = model.data(modelIndex, MultitrackModel::FadeOutRole).toInt(); setText(QObject::tr("Adjust fade out")); } void FadeOutCommand::redo() { m_model.fadeOut(m_trackIndex, m_clipIndex, m_duration); } void FadeOutCommand::undo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex << "duration" << m_duration; m_model.fadeOut(m_trackIndex, m_clipIndex, m_previous); } bool FadeOutCommand::mergeWith(const QUndoCommand *other) { const FadeOutCommand *that = static_cast<const FadeOutCommand *>(other); if (that->id() != id() || that->m_trackIndex != m_trackIndex || that->m_clipIndex != m_clipIndex || (!that->m_duration && m_duration != that->m_duration)) return false; m_duration = static_cast<const FadeOutCommand *>(other)->m_duration; return true; } AddTransitionCommand::AddTransitionCommand(TimelineDock &timeline, int trackIndex, int clipIndex, int position, bool ripple, QUndoCommand *parent) : QUndoCommand(parent) , m_timeline(timeline) , m_model(*m_timeline.model()) , m_markersModel(*m_timeline.markersModel()) , m_trackIndex(trackIndex) , m_clipIndex(clipIndex) , m_position(position) , m_transitionIndex(-1) , m_ripple(ripple) , m_undoHelper(*m_timeline.model()) , m_rippleAllTracks(Settings.timelineRippleAllTracks()) , m_rippleMarkers(Settings.timelineRippleMarkers()) , m_markerOldStart(-1) , m_markerNewStart(-1) { setText(QObject::tr("Add transition")); } void AddTransitionCommand::redo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex << "position" << m_position; if (m_rippleMarkers) { // Calculate the marker delta before moving anything auto mlt_index = m_model.trackList().at(m_trackIndex).mlt_index; QScopedPointer<Mlt::Producer> track(m_model.tractor()->track(mlt_index)); if (track && track->is_valid()) { Mlt::Playlist playlist(*track); m_markerOldStart = playlist.clip_start(m_clipIndex); m_markerNewStart = m_position; } } m_undoHelper.recordBeforeState(); m_transitionIndex = m_model.addTransition(m_trackIndex, m_clipIndex, m_position, m_ripple, m_rippleAllTracks); LOG_DEBUG() << "m_transitionIndex" << m_transitionIndex; m_undoHelper.recordAfterState(); // Remove and shift markers as appropriate bool markersModified = false; if (m_transitionIndex >= 0 && m_rippleMarkers && m_markerOldStart >= 0) { m_markers = m_markersModel.getMarkers(); QList<Markers::Marker> newMarkers = m_markers; int startDelta = m_markerNewStart - m_markerOldStart; for (int i = 0; i < newMarkers.size(); i++) { Markers::Marker &marker = newMarkers[i]; if (marker.start <= m_markerOldStart && marker.start > m_markerNewStart) { // This marker is in the overwritten segment. Remove it newMarkers.removeAt(i); i--; markersModified = true; } else if (marker.start >= m_markerOldStart) { // This marker is after the start of the moved segment. Shift it with the move marker.start += startDelta; marker.end += startDelta; markersModified = true; } } if (markersModified) { m_markersModel.doReplace(newMarkers); } } if (!markersModified) { m_markerOldStart = -1; m_markers.clear(); } } void AddTransitionCommand::undo() { if (m_transitionIndex >= 0) { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex << "position" << m_position; m_undoHelper.undoChanges(); m_timeline.setSelection(QList<QPoint>() << QPoint(m_clipIndex, m_trackIndex)); if (m_rippleMarkers && m_markerOldStart >= 0) { m_markersModel.doReplace(m_markers); } } } TrimTransitionInCommand::TrimTransitionInCommand(MultitrackModel &model, int trackIndex, int clipIndex, int delta, bool redo, QUndoCommand *parent) : TrimCommand(parent) , m_model(model) , m_trackIndex(qBound(0, trackIndex, qMax(model.rowCount() - 1, 0))) , m_clipIndex(clipIndex) , m_delta(delta) , m_notify(false) , m_redo(redo) { setText(QObject::tr("Trim transition in point")); } void TrimTransitionInCommand::redo() { if (m_redo) { m_model.trimTransitionIn(m_trackIndex, m_clipIndex, m_delta); if (m_notify && m_clipIndex >= 0) m_model.notifyClipIn(m_trackIndex, m_clipIndex); } else { m_redo = true; } } void TrimTransitionInCommand::undo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex << "delta" << m_delta; if (m_clipIndex >= 0) { m_model.trimTransitionIn(m_trackIndex, m_clipIndex, -m_delta); m_model.notifyClipIn(m_trackIndex, m_clipIndex); m_notify = true; } else LOG_WARNING() << "invalid clip index" << m_clipIndex; } bool TrimTransitionInCommand::mergeWith(const QUndoCommand *other) { const TrimTransitionInCommand *that = static_cast<const TrimTransitionInCommand *>(other); if (that->id() != id() || that->m_trackIndex != m_trackIndex || that->m_clipIndex != m_clipIndex) return false; m_delta += static_cast<const TrimTransitionInCommand *>(other)->m_delta; return true; } TrimTransitionOutCommand::TrimTransitionOutCommand(MultitrackModel &model, int trackIndex, int clipIndex, int delta, bool redo, QUndoCommand *parent) : TrimCommand(parent) , m_model(model) , m_trackIndex(qBound(0, trackIndex, qMax(model.rowCount() - 1, 0))) , m_clipIndex(clipIndex) , m_delta(delta) , m_notify(false) , m_redo(redo) { setText(QObject::tr("Trim transition out point")); } void TrimTransitionOutCommand::redo() { if (m_redo) { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex; m_model.trimTransitionOut(m_trackIndex, m_clipIndex, m_delta); if (m_notify && m_clipIndex >= 0) m_model.notifyClipOut(m_trackIndex, m_clipIndex); } else { m_redo = true; } } void TrimTransitionOutCommand::undo() { if (m_clipIndex >= 0) { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex << "delta" << m_delta; m_model.trimTransitionOut(m_trackIndex, m_clipIndex, -m_delta); m_model.notifyClipOut(m_trackIndex, m_clipIndex); m_notify = true; } else LOG_WARNING() << "invalid clip index" << m_clipIndex; } bool TrimTransitionOutCommand::mergeWith(const QUndoCommand *other) { const TrimTransitionOutCommand *that = static_cast<const TrimTransitionOutCommand *>(other); if (that->id() != id() || that->m_trackIndex != m_trackIndex || that->m_clipIndex != m_clipIndex) return false; m_delta += static_cast<const TrimTransitionOutCommand *>(other)->m_delta; return true; } AddTransitionByTrimInCommand::AddTransitionByTrimInCommand(TimelineDock &timeline, int trackIndex, int clipIndex, int duration, int trimDelta, bool redo, QUndoCommand *parent) : TrimCommand(parent) , m_timeline(timeline) , m_trackIndex(qBound(0, trackIndex, qMax(timeline.model()->rowCount() - 1, 0))) , m_clipIndex(clipIndex) , m_duration(duration) , m_trimDelta(trimDelta) , m_notify(false) , m_redo(redo) { setText(QObject::tr("Add transition")); } void AddTransitionByTrimInCommand::redo() { if (m_redo) { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex << "delta" << m_trimDelta << "duration" << m_duration; if (m_trimDelta) m_timeline.model()->trimClipIn(m_trackIndex, m_clipIndex + 1, m_trimDelta, false, false); m_timeline.model()->addTransitionByTrimIn(m_trackIndex, m_clipIndex, m_duration); if (m_notify && m_clipIndex > 0) m_timeline.model()->notifyClipOut(m_trackIndex, m_clipIndex - 1); m_timeline.setSelection(QList<QPoint>() << QPoint(m_clipIndex + 1, m_trackIndex)); } else { m_redo = true; } } void AddTransitionByTrimInCommand::undo() { if (m_clipIndex > 0) { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex << "delta" << m_trimDelta; m_timeline.model()->removeTransitionByTrimIn(m_trackIndex, m_clipIndex, -m_trimDelta); m_notify = true; m_timeline.setSelection(QList<QPoint>() << QPoint(m_clipIndex, m_trackIndex)); } else LOG_WARNING() << "invalid clip index" << m_clipIndex; } bool AddTransitionByTrimInCommand::mergeWith(const QUndoCommand *other) { const AddTransitionByTrimInCommand *that = static_cast<const AddTransitionByTrimInCommand *>(other); if (that->id() != id() || that->m_trackIndex != m_trackIndex || (that->m_clipIndex != m_clipIndex && m_clipIndex != that->m_clipIndex - 1)) return false; return true; } RemoveTransitionByTrimInCommand::RemoveTransitionByTrimInCommand(MultitrackModel &model, int trackIndex, int clipIndex, int delta, QString xml, bool redo, QUndoCommand *parent) : TrimCommand(parent) , m_model(model) , m_trackIndex(qBound(0, trackIndex, qMax(model.rowCount() - 1, 0))) , m_clipIndex(clipIndex) , m_delta(delta) , m_xml(xml) , m_redo(redo) { setText(QObject::tr("Remove transition")); } void RemoveTransitionByTrimInCommand::redo() { if (m_redo) { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex; QModelIndex modelIndex = m_model.makeIndex(m_trackIndex, m_clipIndex); int n = m_model.data(modelIndex, MultitrackModel::DurationRole).toInt(); m_model.liftClip(m_trackIndex, m_clipIndex); m_model.trimClipIn(m_trackIndex, m_clipIndex + 1, -n, false, false); m_model.notifyClipIn(m_trackIndex, m_clipIndex + 1); } else { m_redo = true; } } void RemoveTransitionByTrimInCommand::undo() { if (m_clipIndex > 0) { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex << "delta" << m_delta; m_model.addTransitionByTrimOut(m_trackIndex, m_clipIndex - 1, m_delta); // Copy properties from old transition to new transition auto clipInfo = m_model.getClipInfo(m_trackIndex, m_clipIndex); Mlt::Service oldService = Mlt::Producer(MLT.profile(), "xml-string", m_xml.toUtf8().constData()); while (oldService.is_valid()) { if (oldService.type() == mlt_service_transition_type) { Mlt::Service newService(clipInfo->producer); while (newService.is_valid()) { if (newService.type() == mlt_service_transition_type && QString(oldService.get("mlt_service")) == QString(newService.get("mlt_service"))) { newService.inherit(oldService); break; } Mlt::Service *tmpNewService = newService.producer(); newService = Mlt::Service(*tmpNewService); delete tmpNewService; } } Mlt::Service *tmpOldService = oldService.producer(); oldService = Mlt::Service(*tmpOldService); delete tmpOldService; } m_model.notifyClipIn(m_trackIndex, m_clipIndex + 1); } else LOG_WARNING() << "invalid clip index" << m_clipIndex; } RemoveTransitionByTrimOutCommand::RemoveTransitionByTrimOutCommand(MultitrackModel &model, int trackIndex, int clipIndex, int delta, QString xml, bool redo, QUndoCommand *parent) : TrimCommand(parent) , m_model(model) , m_trackIndex(qBound(0, trackIndex, qMax(model.rowCount() - 1, 0))) , m_clipIndex(clipIndex) , m_delta(delta) , m_xml(xml) , m_redo(redo) { setText(QObject::tr("Remove transition")); } void RemoveTransitionByTrimOutCommand::redo() { if (m_redo) { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex; QModelIndex modelIndex = m_model.makeIndex(m_trackIndex, m_clipIndex); int n = m_model.data(modelIndex, MultitrackModel::DurationRole).toInt(); m_model.liftClip(m_trackIndex, m_clipIndex); m_model.trimClipOut(m_trackIndex, m_clipIndex - 1, -n, false, false); m_model.notifyClipOut(m_trackIndex, m_clipIndex - 1); } else { m_redo = true; } } void RemoveTransitionByTrimOutCommand::undo() { if (m_clipIndex > 0) { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex << "delta" << m_delta; m_model.addTransitionByTrimIn(m_trackIndex, m_clipIndex, m_delta); // Copy properties from old transition to new transition auto clipInfo = m_model.getClipInfo(m_trackIndex, m_clipIndex); Mlt::Service oldService = Mlt::Producer(MLT.profile(), "xml-string", m_xml.toUtf8().constData()); while (oldService.is_valid()) { if (oldService.type() == mlt_service_transition_type) { Mlt::Service newService(clipInfo->producer); while (newService.is_valid()) { if (newService.type() == mlt_service_transition_type && QString(oldService.get("mlt_service")) == QString(newService.get("mlt_service"))) { newService.inherit(oldService); break; } Mlt::Service *tmpNewService = newService.producer(); newService = Mlt::Service(*tmpNewService); delete tmpNewService; } } Mlt::Service *tmpOldService = oldService.producer(); oldService = Mlt::Service(*tmpOldService); delete tmpOldService; } m_model.notifyClipOut(m_trackIndex, m_clipIndex - 1); } else LOG_WARNING() << "invalid clip index" << m_clipIndex; } AddTransitionByTrimOutCommand::AddTransitionByTrimOutCommand(MultitrackModel &model, int trackIndex, int clipIndex, int duration, int trimDelta, bool redo, QUndoCommand *parent) : TrimCommand(parent) , m_model(model) , m_trackIndex(qBound(0, trackIndex, qMax(model.rowCount() - 1, 0))) , m_clipIndex(clipIndex) , m_duration(duration) , m_trimDelta(trimDelta) , m_notify(false) , m_redo(redo) { setText(QObject::tr("Add transition")); } void AddTransitionByTrimOutCommand::redo() { if (m_redo) { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex << "delta" << m_trimDelta << "duration" << m_duration; if (m_trimDelta) m_model.trimClipOut(m_trackIndex, m_clipIndex, m_trimDelta, false, false); m_model.addTransitionByTrimOut(m_trackIndex, m_clipIndex, m_duration); if (m_notify) m_model.notifyClipIn(m_trackIndex, m_clipIndex + 2); } else { m_redo = true; } } void AddTransitionByTrimOutCommand::undo() { if (m_clipIndex + 2 < m_model.rowCount(m_model.index(m_trackIndex))) { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex << "delta" << m_trimDelta; m_model.removeTransitionByTrimOut(m_trackIndex, m_clipIndex, -m_trimDelta); m_notify = true; } else LOG_WARNING() << "invalid clip index" << m_clipIndex; } bool AddTransitionByTrimOutCommand::mergeWith(const QUndoCommand *other) { const AddTransitionByTrimOutCommand *that = static_cast<const AddTransitionByTrimOutCommand *> (other); if (that->id() != id() || that->m_trackIndex != m_trackIndex || that->m_clipIndex != m_clipIndex) return false; return true; } AddTrackCommand::AddTrackCommand(MultitrackModel &model, bool isVideo, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_isVideo(isVideo) { if (isVideo) setText(QObject::tr("Add video track")); else setText(QObject::tr("Add audio track")); } void AddTrackCommand::redo() { LOG_DEBUG() << (m_isVideo ? "video" : "audio"); if (m_isVideo) m_trackIndex = m_model.addVideoTrack(); else m_trackIndex = m_model.addAudioTrack(); int mlt_index = m_model.trackList().at(m_trackIndex).mlt_index; std::unique_ptr<Mlt::Multitrack> multitrack(m_model.tractor()->multitrack()); if (!multitrack || !multitrack->is_valid()) return; std::unique_ptr<Mlt::Producer> producer(multitrack->track(mlt_index)); if (producer && producer->is_valid()) { if (m_uuid.isNull()) { m_uuid = MLT.ensureHasUuid(*producer); } else { MLT.setUuid(*producer, m_uuid); } } } void AddTrackCommand::undo() { LOG_DEBUG() << (m_isVideo ? "video" : "audio") << m_uuid; m_model.removeTrack(m_trackIndex); } InsertTrackCommand::InsertTrackCommand(MultitrackModel &model, int trackIndex, TrackType trackType, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_trackIndex(qBound(0, trackIndex, qMax(model.rowCount() - 1, 0))) , m_trackType(trackType) { if (trackType != AudioTrackType && trackType != VideoTrackType) { m_trackType = model.trackList().size() > 0 ? model.trackList().at(m_trackIndex).type : VideoTrackType; } if (m_trackType == AudioTrackType) setText(QObject::tr("Insert audio track")); else if (m_trackType == VideoTrackType) setText(QObject::tr("Insert video track")); } void InsertTrackCommand::redo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "type" << (m_trackType == AudioTrackType ? "audio" : "video"); m_model.insertTrack(m_trackIndex, m_trackType); int mlt_index = m_model.trackList().at(m_trackIndex).mlt_index; std::unique_ptr<Mlt::Multitrack> multitrack(m_model.tractor()->multitrack()); if (!multitrack || !multitrack->is_valid()) return; std::unique_ptr<Mlt::Producer> producer(multitrack->track(mlt_index)); if (producer && producer->is_valid()) { if (m_uuid.isNull()) { m_uuid = MLT.ensureHasUuid(*producer); } else { MLT.setUuid(*producer, m_uuid); } } } void InsertTrackCommand::undo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "type" << (m_trackType == AudioTrackType ? "audio" : "video"); m_model.removeTrack(m_trackIndex); } RemoveTrackCommand::RemoveTrackCommand(MultitrackModel &model, int trackIndex, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_trackIndex(qBound(0, trackIndex, qMax(model.rowCount() - 1, 0))) , m_trackType(model.trackList().at(m_trackIndex).type) , m_undoHelper(model) { if (m_trackType == AudioTrackType) setText(QObject::tr("Remove audio track")); else if (m_trackType == VideoTrackType) setText(QObject::tr("Remove video track")); // Get the track as MLT playlist. int mlt_index = m_model.trackList().at(m_trackIndex).mlt_index; QScopedPointer<Mlt::Producer> producer(m_model.tractor()->track(mlt_index)); if (producer && producer->is_valid()) { // Save track name. m_trackName = QString::fromUtf8(producer->get(kTrackNameProperty)); // Save producer UUID. m_uuid = MLT.ensureHasUuid(*producer); // Save the track filters. if (producer->filter_count() > 0) { m_filtersProducer.reset(new Mlt::Producer(MLT.profile(), "color")); if (m_filtersProducer->is_valid()) MLT.copyFilters(*producer, *m_filtersProducer); } } } void RemoveTrackCommand::redo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "type" << (m_trackType == AudioTrackType ? "audio" : "video"); m_undoHelper.recordBeforeState(); int mlt_index = m_model.trackList().at(m_trackIndex).mlt_index; QScopedPointer<Mlt::Producer> producer(m_model.tractor()->track(mlt_index)); Mlt::Playlist playlist(*producer); for (int i = 0; i < playlist.count(); ++i) { if (!playlist.is_blank(i)) emit m_model.removing(playlist.get_clip(i)); } playlist.clear(); m_undoHelper.recordAfterState(); m_model.removeTrack(m_trackIndex); } void RemoveTrackCommand::undo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "type" << (m_trackType == AudioTrackType ? "audio" : "video"); m_model.insertTrack(m_trackIndex, m_trackType); m_model.setTrackName(m_trackIndex, m_trackName); // Restore track contents from UndoHelper. m_undoHelper.undoChanges(); // Re-attach filters. int mlt_index = m_model.trackList().at(m_trackIndex).mlt_index; QScopedPointer<Mlt::Producer> producer(m_model.tractor()->track(mlt_index)); Mlt::Playlist playlist(*producer); if (playlist.is_valid() && m_filtersProducer && m_filtersProducer->is_valid()) { MLT.setUuid(playlist, m_uuid); MLT.copyFilters(*m_filtersProducer, playlist); QModelIndex modelIndex = m_model.index(m_trackIndex); emit m_model.dataChanged(modelIndex, modelIndex, QVector<int>() << MultitrackModel::IsFilteredRole); } } MoveTrackCommand::MoveTrackCommand(MultitrackModel &model, int fromTrackIndex, int toTrackIndex, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_fromTrackIndex(qBound(0, fromTrackIndex, qMax(model.rowCount() - 1, 0))) , m_toTrackIndex(qBound(0, toTrackIndex, qMax(model.rowCount() - 1, 0))) { if (m_toTrackIndex > m_fromTrackIndex) setText(QObject::tr("Move track down")); else setText(QObject::tr("Move track up")); } void MoveTrackCommand::redo() { LOG_DEBUG() << "fromTrackIndex" << m_fromTrackIndex << "toTrackIndex" << m_toTrackIndex; m_model.moveTrack(m_fromTrackIndex, m_toTrackIndex); } void MoveTrackCommand::undo() { LOG_DEBUG() << "fromTrackIndex" << m_fromTrackIndex << "toTrackIndex" << m_toTrackIndex; m_model.moveTrack(m_toTrackIndex, m_fromTrackIndex); } ChangeBlendModeCommand::ChangeBlendModeCommand(Mlt::Transition &transition, const QString &propertyName, const QString &mode, QUndoCommand *parent) : QUndoCommand(parent) , m_transition(transition) , m_propertyName(propertyName) , m_newMode(mode) { setText(QObject::tr("Change track blend mode")); m_oldMode = m_transition.get(m_propertyName.toLatin1().constData()); } void ChangeBlendModeCommand::redo() { LOG_DEBUG() << "mode" << m_newMode; if (!m_newMode.isEmpty()) { m_transition.set("disable", 0); m_transition.set(m_propertyName.toLatin1().constData(), m_newMode.toUtf8().constData()); } else { m_transition.set("disable", 1); } MLT.refreshConsumer(); emit modeChanged(m_newMode); } void ChangeBlendModeCommand::undo() { LOG_DEBUG() << "mode" << m_newMode; if (!m_oldMode.isEmpty()) { m_transition.set("disable", 0); m_transition.set(m_propertyName.toLatin1().constData(), m_oldMode.toUtf8().constData()); } else { m_transition.set("disable", 1); } MLT.refreshConsumer(); emit modeChanged(m_oldMode); } UpdateCommand::UpdateCommand(TimelineDock &timeline, int trackIndex, int clipIndex, int position, QUndoCommand *parent) : QUndoCommand(parent) , m_timeline(timeline) , m_trackIndex(trackIndex) , m_clipIndex(clipIndex) , m_position(position) , m_isFirstRedo(true) , m_undoHelper(*timeline.model()) , m_ripple(Settings.timelineRipple()) , m_rippleAllTracks(Settings.timelineRippleAllTracks()) { setText(QObject::tr("Change clip properties")); m_undoHelper.recordBeforeState(); } void UpdateCommand::setXmlAfter(const QString &xml) { m_xmlAfter = xml; m_ripple = Settings.timelineRipple(); m_rippleAllTracks = Settings.timelineRippleAllTracks(); } void UpdateCommand::setPosition(int trackIndex, int clipIndex, int position) { if (trackIndex >= 0) m_trackIndex = trackIndex; if (clipIndex >= 0) m_clipIndex = clipIndex; if (position >= 0) m_position = position; m_undoHelper.recordBeforeState(); } void UpdateCommand::setRippleAllTracks(bool ripple) { m_rippleAllTracks = ripple; } void UpdateCommand::redo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex << "position" << m_position; if (!m_isFirstRedo) m_undoHelper.recordBeforeState(); Mlt::Producer clip(MLT.profile(), "xml-string", m_xmlAfter.toUtf8().constData()); if (m_ripple) { m_timeline.model()->removeClip(m_trackIndex, m_clipIndex, m_rippleAllTracks); m_timeline.model()->insertClip(m_trackIndex, clip, m_position, m_rippleAllTracks, false); } else { m_timeline.model()->liftClip(m_trackIndex, m_clipIndex); m_timeline.model()->overwrite(m_trackIndex, clip, m_position, false); } m_undoHelper.recordAfterState(); } void UpdateCommand::undo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex << "position" << m_position; m_undoHelper.undoChanges(); m_timeline.setSelection(QList<QPoint>() << QPoint(m_clipIndex, m_trackIndex)); m_isFirstRedo = false; } DetachAudioCommand::DetachAudioCommand(TimelineDock &timeline, int trackIndex, int clipIndex, int position, const QString &xml, QUndoCommand *parent) : QUndoCommand(parent) , m_timeline(timeline) , m_trackIndex(qBound(0, trackIndex, qMax(timeline.model()->rowCount() - 1, 0))) , m_clipIndex(clipIndex) , m_position(position) , m_targetTrackIndex(-1) , m_xml(xml) , m_undoHelper(*timeline.model()) , m_trackAdded(false) { setText(QObject::tr("Detach Audio")); } void DetachAudioCommand::redo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex << "position" << m_position; Mlt::Producer audioClip(MLT.profile(), "xml-string", m_xml.toUtf8().constData()); Mlt::Producer videoClip(MLT.profile(), "xml-string", m_xml.toUtf8().constData()); int groupNumber = -1; if (audioClip.is_valid() && videoClip.is_valid()) { auto model = m_timeline.model(); // Save the group number if it exists { auto videoClipInfo = model->getClipInfo(m_trackIndex, m_clipIndex); if (videoClipInfo && videoClipInfo->cut && videoClipInfo->cut->property_exists(kShotcutGroupProperty)) { groupNumber = videoClipInfo->cut->get_int(kShotcutGroupProperty); } } // Disable audio on the video clip. videoClip.set("astream", -1); videoClip.set("audio_index", -1); // Remove audio filters from the video clip. for (int i = 0; i < videoClip.filter_count(); i++) { Mlt::Filter *filter = videoClip.filter(i); if (filter && filter->is_valid() && !filter->get_int("_loader") && !filter->get_int(kShotcutHiddenProperty)) { QmlMetadata *newMeta = MAIN.filterController()->metadataForService(filter); if (newMeta && newMeta->isAudio()) { videoClip.detach(*filter); i--; } } delete filter; } // Disable video on the audio clip. audioClip.set("vstream", -1); audioClip.set("video_index", -1); // Remove video filters from the audio clip. for (int i = 0; i < audioClip.filter_count(); i++) { Mlt::Filter *filter = audioClip.filter(i); if (filter && filter->is_valid() && !filter->get_int("_loader") && !filter->get_int(kShotcutHiddenProperty)) { QmlMetadata *newMeta = MAIN.filterController()->metadataForService(filter); if (newMeta && !newMeta->isAudio()) { audioClip.detach(*filter); i--; } } delete filter; } // Add an audio track if needed. int n = model->trackList().size(); for (int i = 0; i < n; i++) { QScopedPointer<Mlt::Producer> track(model->tractor()->track(model->trackList()[i].mlt_index)); if (!track->is_valid()) continue; if (track->get(kAudioTrackProperty)) { Mlt::Playlist playlist(*track.data()); int out = videoClip.get_playtime() - 1; // If the audio track is blank in the target region. if (playlist.is_blank_at(m_position) && playlist.is_blank_at(m_position + out) && playlist.get_clip_index_at(m_position) == playlist.get_clip_index_at(m_position + out)) { // Save the target track index. m_targetTrackIndex = i; break; } } } if (m_targetTrackIndex == -1) { // No target audio track m_targetTrackIndex = model->addAudioTrack(); m_trackAdded = m_targetTrackIndex > -1; } if (m_targetTrackIndex > -1) { // Set the producer UUID on the new track. int mlt_index = model->trackList().at(m_targetTrackIndex).mlt_index; std::unique_ptr<Mlt::Multitrack> multitrack(model->tractor()->multitrack()); if (multitrack && !multitrack->is_valid()) { std::unique_ptr<Mlt::Producer> producer(multitrack->track(mlt_index)); if (producer && producer->is_valid()) { if (m_uuid.isNull()) { m_uuid = MLT.ensureHasUuid(*producer); } else { MLT.setUuid(*producer, m_uuid); } } } m_undoHelper.recordBeforeState(); // Add the clip to the new audio track. model->overwrite(m_targetTrackIndex, audioClip, m_position, false); // Replace the original clip with the video only clip model->overwrite(m_trackIndex, videoClip, m_position, false); // Restore the video clip group if (groupNumber >= 0) { auto videoClipInfo = model->getClipInfo(m_trackIndex, m_clipIndex); if (videoClipInfo && videoClipInfo->cut) { videoClipInfo->cut->set(kShotcutGroupProperty, groupNumber); } } m_undoHelper.recordAfterState(); QModelIndex modelIndex = model->makeIndex(m_trackIndex, m_clipIndex); emit model->dataChanged(modelIndex, modelIndex, QVector<int>() << MultitrackModel::AudioIndexRole << MultitrackModel::GroupRole); m_timeline.setSelection(QList<QPoint>() << QPoint(m_clipIndex, m_trackIndex)); } } } void DetachAudioCommand::undo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex << "position" << m_position; auto model = m_timeline.model(); m_undoHelper.undoChanges(); if (m_trackAdded) { // Remove the new audio track. model->removeTrack(m_targetTrackIndex); m_targetTrackIndex = -1; } Mlt::Producer originalClip(MLT.profile(), "xml-string", m_xml.toUtf8().constData()); model->overwrite(m_trackIndex, originalClip, m_position, true); QModelIndex modelIndex = model->makeIndex(m_trackIndex, m_clipIndex); emit model->dataChanged(modelIndex, modelIndex, QVector<int>() << MultitrackModel::AudioIndexRole << MultitrackModel::AudioLevelsRole << MultitrackModel::GroupRole); m_timeline.setSelection(QList<QPoint>() << QPoint(m_clipIndex, m_trackIndex)); } ReplaceCommand::ReplaceCommand(MultitrackModel &model, int trackIndex, int clipIndex, const QString &xml, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_trackIndex(qBound(0, trackIndex, qMax(model.rowCount() - 1, 0))) , m_clipIndex(clipIndex) , m_xml(xml) , m_isFirstRedo(true) , m_undoHelper(model) { setText(QObject::tr("Replace timeline clip")); m_undoHelper.recordBeforeState(); } void ReplaceCommand::redo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex; if (!m_isFirstRedo) m_undoHelper.recordBeforeState(); Mlt::Producer clip(MLT.profile(), "xml-string", m_xml.toUtf8().constData()); m_model.replace(m_trackIndex, m_clipIndex, clip); m_undoHelper.recordAfterState(); } void ReplaceCommand::undo() { LOG_DEBUG() << "trackIndex" << m_trackIndex << "clipIndex" << m_clipIndex; m_undoHelper.undoChanges(); m_isFirstRedo = false; } AlignClipsCommand::AlignClipsCommand(MultitrackModel &model, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_undoHelper(m_model) , m_redo(false) { m_undoHelper.setHints(UndoHelper::RestoreTracks); m_undoHelper.recordBeforeState(); setText(QObject::tr("Align clips to reference track")); } void AlignClipsCommand::addAlignment(QUuid uuid, int offset, double speed) { Alignment alignment; alignment.uuid = uuid; alignment.offset = offset; alignment.speed = speed; m_alignments.append(alignment); } void AlignClipsCommand::redo() { LOG_DEBUG() << "Alignment Clips:" << m_alignments.size(); struct ClipItem { Mlt::Producer *clip; int track; int start; }; QVector<ClipItem> clipMemory; // Remove all the clips and remember them. for (auto &alignment : m_alignments) { int trackIndex, clipIndex; auto info = m_model.findClipByUuid(alignment.uuid, trackIndex, clipIndex); if (!info || !info->cut || !info->cut->is_valid()) { continue; } ClipItem item; if (alignment.speed != 1.0) { double warpspeed = Util::GetSpeedFromProducer(info->producer) * alignment.speed; QString filename = Util::GetFilenameFromProducer(info->producer, false); QString s = QStringLiteral("%1:%2:%3").arg("timewarp").arg(warpspeed).arg(filename); item.clip = new Mlt::Producer(MLT.profile(), s.toUtf8().constData()); if (!item.clip || !item.clip->is_valid()) { delete item.clip; continue; } Util::passProducerProperties(info->producer, item.clip); Util::updateCaption(item.clip); int length = qRound(info->producer->get_length() / alignment.speed); int in = qRound(info->cut->get_in() / alignment.speed); int out = qRound(info->cut->get_out() / alignment.speed); item.clip->set("length", item.clip->frames_to_time(length, mlt_time_clock)); item.clip->set_in_and_out(in, out); MLT.copyFilters(*info->producer, *item.clip); } else { item.clip = new Mlt::Producer(info->cut); } item.track = trackIndex; item.start = alignment.offset; clipMemory.append(item); m_model.liftClip(trackIndex, clipIndex); } // Place all the clips back in the new spot. for (auto &item : clipMemory) { m_model.overwrite(item.track, *item.clip, item.start, false, false); delete item.clip; } if (!m_redo) { m_redo = true; m_undoHelper.recordAfterState(); } } void AlignClipsCommand::undo() { m_undoHelper.undoChanges(); } ApplyFiltersCommand::ApplyFiltersCommand(MultitrackModel &model, const QString &filterProducerXml, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_xml(filterProducerXml) { setText(QObject::tr("Apply copied filters")); } void ApplyFiltersCommand::addClip(int trackIndex, int clipIndex) { auto clipInfo = m_model.getClipInfo(trackIndex, clipIndex); if (clipInfo && clipInfo->producer && !clipInfo->cut->is_blank() ) { ClipPosition position(trackIndex, clipIndex); m_prevFilters.insert(position, MLT.XML(clipInfo->producer)); } } void ApplyFiltersCommand::redo() { LOG_DEBUG() << "clips:" << m_prevFilters.size(); Mlt::Producer filtersProducer(MLT.profile(), "xml-string", m_xml.toUtf8().constData()); if (!filtersProducer.is_valid() || filtersProducer.filter_count() < 1 || !filtersProducer.get_int(kShotcutFiltersClipboard)) { LOG_ERROR() << "Invalid filters producer"; return; } // Get the metadata for all the applied filters QList<QmlMetadata *> m_applyMeta; for (int i = 0; i < filtersProducer.filter_count(); i++) { Mlt::Filter *filter = filtersProducer.filter(i); if (filter && filter->is_valid() && !filter->get_int("_loader") && !filter->get_int(kShotcutHiddenProperty)) { m_applyMeta.append(MAIN.filterController()->metadataForService(filter)); } delete filter; } for (auto &clip : m_prevFilters.keys()) { auto clipInfo = m_model.getClipInfo(clip.trackIndex, clip.clipIndex); if (clipInfo && clipInfo->producer) { // Remove any filters that would be duplicated by the new filters for (int i = 0; i < clipInfo->producer->filter_count(); i++) { Mlt::Filter *filter = clipInfo->producer->filter(i); if (filter && filter->is_valid() && !filter->get_int("_loader") && !filter->get_int(kShotcutHiddenProperty)) { QmlMetadata *currentMeta = MAIN.filterController()->metadataForService(filter); for (int j = 0; j < m_applyMeta.size(); j++) { if (m_applyMeta[j] == currentMeta) { clipInfo->producer->detach(*filter); i--; break; } } } delete filter; } // Apply the new filters MLT.pasteFilters(clipInfo->producer, &filtersProducer); // Report that the filters have changed. m_model.filterAddedOrRemoved(clipInfo->producer); } else { LOG_ERROR() << "Unable to find clip" << clip.trackIndex << clip.clipIndex; } } } void ApplyFiltersCommand::undo() { LOG_DEBUG() << "clips:" << m_prevFilters.size(); for (auto &clip : m_prevFilters.keys()) { auto clipInfo = m_model.getClipInfo(clip.trackIndex, clip.clipIndex); if (clipInfo && clipInfo->producer) { // Remove existing filters for (int i = 0; i < clipInfo->producer->filter_count(); i++) { Mlt::Filter *filter = clipInfo->producer->filter(i); if (filter && filter->is_valid() && !filter->get_int("_loader") && !filter->get_int(kShotcutHiddenProperty)) { clipInfo->producer->detach(*filter); i--; } delete filter; } // Copy the previous filters Mlt::Producer previousProducer(MLT.profile(), "xml-string", m_prevFilters[clip].toUtf8().constData()); if (previousProducer.is_valid()) { // Apply the previous filters MLT.pasteFilters(clipInfo->producer, &previousProducer); // Report that the filters have changed. m_model.filterAddedOrRemoved(clipInfo->producer); } else { LOG_ERROR() << "Unable to restore previous producer"; } } else { LOG_ERROR() << "Unable to find clip" << clip.trackIndex << clip.clipIndex; } } } } // namespace #include "moc_timelinecommands.cpp"
81,369
C++
.cpp
1,953
33.341526
154
0.616065
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
13,260
subtitlecommands.cpp
mltframework_shotcut/src/commands/subtitlecommands.cpp
/* * Copyright (c) 2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "subtitlecommands.h" #include <Logger.h> #include <mainwindow.h> #include <QFileInfo> namespace Subtitles { InsertTrackCommand::InsertTrackCommand(SubtitlesModel &model, const SubtitlesModel::SubtitleTrack &track, int index) : QUndoCommand(0) , m_model(model) , m_track(track) , m_index(index) { setText(QObject::tr("Add subtitle track: %1").arg(m_track.name)); } void InsertTrackCommand::redo() { LOG_DEBUG() << m_track.name; m_model.doInsertTrack(m_track, m_index); } void InsertTrackCommand::undo() { m_model.doRemoveTrack(m_index); } RemoveTrackCommand::RemoveTrackCommand(SubtitlesModel &model, int trackIndex) : QUndoCommand(0) , m_model(model) , m_trackIndex(trackIndex) , m_saveTrack(m_model.getTrack(trackIndex)) { setText(QObject::tr("Remove subtitle track: %1").arg(m_saveTrack.name)); int count = m_model.itemCount(m_trackIndex); m_saveSubtitles.reserve(count); for (int i = 0; i < count; i++) { m_saveSubtitles.push_back(m_model.getItem(m_trackIndex, i)); } } void RemoveTrackCommand::redo() { m_model.doRemoveTrack(m_trackIndex); } void RemoveTrackCommand::undo() { m_model.doInsertTrack(m_saveTrack, m_trackIndex); m_model.doInsertSubtitleItems(m_trackIndex, m_saveSubtitles); } EditTrackCommand::EditTrackCommand(SubtitlesModel &model, const SubtitlesModel::SubtitleTrack &track, int index) : QUndoCommand(0) , m_model(model) , m_newTrack(track) , m_index(index) { m_oldTrack = m_model.getTrack(index); setText(QObject::tr("Edit subtitle track: %1").arg(m_newTrack.name)); } void EditTrackCommand::redo() { LOG_DEBUG() << m_oldTrack.name; m_model.doEditTrack(m_newTrack, m_index); } void EditTrackCommand::undo() { m_model.doEditTrack(m_oldTrack, m_index); } OverwriteSubtitlesCommand::OverwriteSubtitlesCommand(SubtitlesModel &model, int trackIndex, const QList<Subtitles::SubtitleItem> &items) : QUndoCommand(0) , m_model(model) , m_trackIndex(trackIndex) , m_newSubtitles(items) { if (m_newSubtitles.size() == 1) { setText(QObject::tr("Add subtitle")); } else { setText(QObject::tr("Add %1 subtitles").arg(m_newSubtitles.size())); } if (m_newSubtitles.size() <= 0) { return; } // Save anything that will be removed int64_t startPosition = m_newSubtitles[0].start; int64_t endPosition = m_newSubtitles[m_newSubtitles.size() - 1].end; int count = m_model.itemCount(m_trackIndex); for (int i = 0; i < count; i++) { auto item = m_model.getItem(m_trackIndex, i); if ((item.start >= startPosition && item.start < endPosition) || (item.end > startPosition && item.end < endPosition)) { m_saveSubtitles.push_back(item); } } } void OverwriteSubtitlesCommand::redo() { LOG_DEBUG() << m_newSubtitles.size(); if (m_newSubtitles.size() > 0) { if (m_saveSubtitles.size() > 0) { m_model.doRemoveSubtitleItems(m_trackIndex, m_saveSubtitles); } m_model.doInsertSubtitleItems(m_trackIndex, m_newSubtitles); } } void OverwriteSubtitlesCommand::undo() { LOG_DEBUG() << m_newSubtitles.size(); if (m_newSubtitles.size() > 0) { m_model.doRemoveSubtitleItems(m_trackIndex, m_newSubtitles); if (m_saveSubtitles.size() > 0) { m_model.doInsertSubtitleItems(m_trackIndex, m_saveSubtitles); } } } RemoveSubtitlesCommand::RemoveSubtitlesCommand(SubtitlesModel &model, int trackIndex, const QList<Subtitles::SubtitleItem> &items) : QUndoCommand(0) , m_model(model) , m_trackIndex(trackIndex) , m_items(items) { if (m_items.size() == 1) { setText(QObject::tr("Remove subtitle")); } else { setText(QObject::tr("Remove %1 subtitles").arg(m_items.size())); } } void RemoveSubtitlesCommand::redo() { LOG_DEBUG() << m_items.size(); m_model.doRemoveSubtitleItems(m_trackIndex, m_items); } void RemoveSubtitlesCommand::undo() { LOG_DEBUG() << m_items.size(); if (m_items.size() > 0) { m_model.doInsertSubtitleItems(m_trackIndex, m_items); } } SetTextCommand::SetTextCommand(SubtitlesModel &model, int trackIndex, int itemIndex, const QString &text) : QUndoCommand(0) , m_model(model) , m_trackIndex(trackIndex) , m_itemIndex(itemIndex) , m_newText(text) { setText(QObject::tr("Edit subtitle text")); m_oldText = QString::fromStdString(m_model.getItem(trackIndex, itemIndex).text); } void SetTextCommand::redo() { m_model.doSetText(m_trackIndex, m_itemIndex, m_newText); } void SetTextCommand::undo() { m_model.doSetText(m_trackIndex, m_itemIndex, m_oldText); } bool SetTextCommand::mergeWith(const QUndoCommand *other) { const SetTextCommand *that = static_cast<const SetTextCommand *>(other); if (m_trackIndex != that->m_trackIndex || m_itemIndex != that->m_itemIndex) { return false; } LOG_DEBUG() << "track" << m_trackIndex << "item" << m_itemIndex; m_newText = that->m_newText; return true; } SetStartCommand::SetStartCommand(SubtitlesModel &model, int trackIndex, int itemIndex, int64_t msTime) : QUndoCommand(0) , m_model(model) , m_trackIndex(trackIndex) , m_itemIndex(itemIndex) , m_newStart(msTime) { setText(QObject::tr("Change subtitle start")); m_oldStart = m_model.getItem(trackIndex, itemIndex).start; } void SetStartCommand::redo() { int64_t endTime = m_model.getItem(m_trackIndex, m_itemIndex).end; m_model.doSetTime(m_trackIndex, m_itemIndex, m_newStart, endTime); } void SetStartCommand::undo() { int64_t endTime = m_model.getItem(m_trackIndex, m_itemIndex).end; m_model.doSetTime(m_trackIndex, m_itemIndex, m_oldStart, endTime); } bool SetStartCommand::mergeWith(const QUndoCommand *other) { const SetStartCommand *that = static_cast<const SetStartCommand *>(other); if (m_trackIndex != that->m_trackIndex || m_itemIndex != that->m_itemIndex) { return false; } LOG_DEBUG() << "track" << m_trackIndex << "item" << m_itemIndex; m_newStart = that->m_newStart; return true; } SetEndCommand::SetEndCommand(SubtitlesModel &model, int trackIndex, int itemIndex, int64_t msTime) : QUndoCommand(0) , m_model(model) , m_trackIndex(trackIndex) , m_itemIndex(itemIndex) , m_newEnd(msTime) { setText(QObject::tr("Change subtitle end")); m_oldEnd = m_model.getItem(trackIndex, itemIndex).end; } void SetEndCommand::redo() { int64_t startTime = m_model.getItem(m_trackIndex, m_itemIndex).start; m_model.doSetTime(m_trackIndex, m_itemIndex, startTime, m_newEnd); } void SetEndCommand::undo() { int64_t startTime = m_model.getItem(m_trackIndex, m_itemIndex).start; m_model.doSetTime(m_trackIndex, m_itemIndex, startTime, m_oldEnd); } bool SetEndCommand::mergeWith(const QUndoCommand *other) { const SetEndCommand *that = static_cast<const SetEndCommand *>(other); if (m_trackIndex != that->m_trackIndex || m_itemIndex != that->m_itemIndex) { return false; } LOG_DEBUG() << "track" << m_trackIndex << "item" << m_itemIndex; m_newEnd = that->m_newEnd; return true; } MoveSubtitlesCommand::MoveSubtitlesCommand(SubtitlesModel &model, int trackIndex, const QList<Subtitles::SubtitleItem> &items, int64_t msTime) : QUndoCommand(0) , m_model(model) , m_trackIndex(trackIndex) , m_oldSubtitles(items) { if (m_oldSubtitles.size() <= 0) { return; } if (m_oldSubtitles.size() == 1) { setText(QObject::tr("Move subtitle")); } else { setText(QObject::tr("Move %1 subtitles").arg(m_oldSubtitles.size())); } // Create a list of subtitles with the new times int64_t delta = msTime - m_oldSubtitles[0].start; for (int i = 0; i < m_oldSubtitles.size(); i++) { m_newSubtitles.push_back(m_oldSubtitles[i]); m_newSubtitles[i].start += delta; m_newSubtitles[i].end += delta; } } void MoveSubtitlesCommand::redo() { LOG_DEBUG() << m_oldSubtitles.size(); m_model.doRemoveSubtitleItems(m_trackIndex, m_oldSubtitles); m_model.doInsertSubtitleItems(m_trackIndex, m_newSubtitles); } void MoveSubtitlesCommand::undo() { LOG_DEBUG() << m_oldSubtitles.size(); m_model.doRemoveSubtitleItems(m_trackIndex, m_newSubtitles); m_model.doInsertSubtitleItems(m_trackIndex, m_oldSubtitles); } bool MoveSubtitlesCommand::mergeWith(const QUndoCommand *other) { const MoveSubtitlesCommand *that = static_cast<const MoveSubtitlesCommand *>(other); if (m_trackIndex != that->m_trackIndex) { return false; } if (m_oldSubtitles.size() != that->m_oldSubtitles.size()) { return false; } if (m_newSubtitles[0].start != that->m_oldSubtitles[0].start) { return false; } LOG_DEBUG() << "track" << m_trackIndex; m_newSubtitles = that->m_newSubtitles; return true; } } // namespace Subtitles
10,036
C++
.cpp
294
28.955782
103
0.668659
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,261
filtercommands.cpp
mltframework_shotcut/src/commands/filtercommands.cpp
/* * Copyright (c) 2021-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "filtercommands.h" #include "qmltypes/qmlmetadata.h" #include "controllers/filtercontroller.h" #include "mainwindow.h" #include "mltcontroller.h" #include <Logger.h> class FindProducerParser : public Mlt::Parser { private: QUuid m_uuid; Mlt::Producer m_producer; public: FindProducerParser(QUuid uuid) : Mlt::Parser() , m_uuid(uuid) {} Mlt::Producer producer() { return m_producer; } int on_start_filter(Mlt::Filter *) { return 0; } int on_start_producer(Mlt::Producer *producer) { if (MLT.uuid(*producer) == m_uuid) { m_producer = producer; return 1; } return 0; } int on_end_producer(Mlt::Producer *) { return 0; } int on_start_playlist(Mlt::Playlist *playlist) { return on_start_producer(playlist); } int on_end_playlist(Mlt::Playlist *) { return 0; } int on_start_tractor(Mlt::Tractor *tractor) { return on_start_producer(tractor); } int on_end_tractor(Mlt::Tractor *) { return 0; } int on_start_multitrack(Mlt::Multitrack *) { return 0; } int on_end_multitrack(Mlt::Multitrack *) { return 0; } int on_start_track() { return 0; } int on_end_track() { return 0; } int on_end_filter(Mlt::Filter *) { return 0; } int on_start_transition(Mlt::Transition *) { return 0; } int on_end_transition(Mlt::Transition *) { return 0; } int on_start_chain(Mlt::Chain *chain) { return on_start_producer(chain); } int on_end_chain(Mlt::Chain *) { return 0; } int on_start_link(Mlt::Link *) { return 0; } int on_end_link(Mlt::Link *) { return 0; } }; static Mlt::Producer findProducer(const QUuid &uuid) { FindProducerParser graphParser(uuid); if (MAIN.isMultitrackValid()) { graphParser.start(*MAIN.multitrack()); if (graphParser.producer().is_valid()) { return graphParser.producer(); } } if (MAIN.playlist() && MAIN.playlist()->count() > 0) { graphParser.start(*MAIN.playlist()); if (graphParser.producer().is_valid()) { return graphParser.producer(); } } Mlt::Producer producer(MLT.isClip() ? MLT.producer() : MLT.savedProducer()); if (producer.is_valid()) { graphParser.start(producer); if (graphParser.producer().is_valid()) { return graphParser.producer(); } } return Mlt::Producer(); } namespace Filter { AddCommand::AddCommand(AttachedFiltersModel &model, const QString &name, Mlt::Service &service, int row, AddCommand::AddType type, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_producer(*model.producer()) , m_producerUuid(MLT.ensureHasUuid(m_producer)) , m_type(type) { if (m_type == AddCommand::AddSingle) { setText(QObject::tr("Add %1 filter").arg(name)); } else { setText(QObject::tr("Add %1 filter set").arg(name)); } m_rows.push_back(row); m_services.push_back(service); } void AddCommand::redo() { LOG_DEBUG() << text() << m_rows[0]; Mlt::Producer producer = m_producer; if (!producer.is_valid()) { producer = findProducer(m_producerUuid); } Q_ASSERT(producer.is_valid()); for (int i = 0; i < m_rows.size(); i++) { m_model.doAddService(producer, m_services[i], m_rows[i]); } // Only hold the producer reference for the first redo and lookup by UUID thereafter. m_producer = Mlt::Producer(); } void AddCommand::undo() { LOG_DEBUG() << text() << m_rows[0]; Mlt::Producer producer(findProducer(m_producerUuid)); Q_ASSERT(producer.is_valid()); // Remove the services in reverse order for (int i = m_rows.size() - 1; i >= 0; i--) { m_model.doRemoveService(producer, m_rows[i]); } } bool AddCommand::mergeWith(const QUndoCommand *other) { AddCommand *that = const_cast<AddCommand *>(static_cast<const AddCommand *>(other)); if (!that || that->id() != id()) { LOG_ERROR() << "Invalid merge"; return false; } if (m_type != AddSet || !(that->m_type == AddSet || that->m_type == AddSetLast)) { // Only merge services from the same filter set return false; } m_type = that->m_type; m_rows.push_back(that->m_rows.front()); m_services.push_back(that->m_services.front()); return true; } RemoveCommand::RemoveCommand(AttachedFiltersModel &model, const QString &name, Mlt::Service &service, int row, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_row(row) , m_producer(*model.producer()) , m_producerUuid(MLT.ensureHasUuid(m_producer)) , m_service(service) { setText(QObject::tr("Remove %1 filter").arg(name)); } void RemoveCommand::redo() { LOG_DEBUG() << text() << m_row; Mlt::Producer producer = m_producer; if (!producer.is_valid()) { producer = findProducer(m_producerUuid); } Q_ASSERT(producer.is_valid()); m_model.doRemoveService(producer, m_row); // Only hold the producer reference for the first redo and lookup by UUID thereafter. m_producer = Mlt::Producer(); } void RemoveCommand::undo() { Q_ASSERT(m_service.is_valid()); LOG_DEBUG() << text() << m_row; Mlt::Producer producer(findProducer(m_producerUuid)); Q_ASSERT(producer.is_valid()); m_model.doAddService(producer, m_service, m_row); } MoveCommand::MoveCommand(AttachedFiltersModel &model, const QString &name, int fromRow, int toRow, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_fromRow(fromRow) , m_toRow(toRow) , m_producer(*model.producer()) , m_producerUuid(MLT.ensureHasUuid(m_producer)) { setText(QObject::tr("Move %1 filter").arg(name)); } void MoveCommand::redo() { LOG_DEBUG() << text() << "from" << m_fromRow << "to" << m_toRow; Mlt::Producer producer = m_producer; if (!producer.is_valid()) { producer = findProducer(m_producerUuid); } Q_ASSERT(producer.is_valid()); if (producer.is_valid()) { m_model.doMoveService(producer, m_fromRow, m_toRow); } if (m_producer.is_valid()) { // Only hold the producer reference for the first redo and lookup by UUID thereafter. m_producer = Mlt::Producer(); } } void MoveCommand::undo() { LOG_DEBUG() << text() << "from" << m_toRow << "to" << m_fromRow; Mlt::Producer producer(findProducer(m_producerUuid)); Q_ASSERT(producer.is_valid()); if (producer.is_valid()) { m_model.doMoveService(producer, m_toRow, m_fromRow); } } DisableCommand::DisableCommand(AttachedFiltersModel &model, const QString &name, int row, bool disabled, QUndoCommand *parent) : QUndoCommand(parent) , m_model(model) , m_row(row) , m_producer(*model.producer()) , m_producerUuid(MLT.ensureHasUuid(m_producer)) , m_disabled(disabled) { if (disabled) { setText(QObject::tr("Disable %1 filter").arg(name)); } else { setText(QObject::tr("Enable %1 filter").arg(name)); } } void DisableCommand::redo() { LOG_DEBUG() << text() << m_row; Mlt::Producer producer = m_producer; if (!producer.is_valid()) { producer = findProducer(m_producerUuid); } Q_ASSERT(producer.is_valid()); if (producer.is_valid()) { m_model.doSetDisabled(producer, m_row, m_disabled); } if (m_producer.is_valid()) { // Only hold the producer reference for the first redo and lookup by UUID thereafter. m_producer = Mlt::Producer(); } } void DisableCommand::undo() { LOG_DEBUG() << text() << m_row; Mlt::Producer producer(findProducer(m_producerUuid)); Q_ASSERT(producer.is_valid()); if (producer.is_valid()) { m_model.doSetDisabled(producer, m_row, !m_disabled); } } bool DisableCommand::mergeWith(const QUndoCommand *other) { // TODO: This doesn't always provide expected results. // If you toggle twice and then undo, you get the opposite of the original state. // It would make sense to merge three toggles in a row, but not two. // Do not implement for now. return false; /* DisableCommand *that = const_cast<DisableCommand *>(static_cast<const DisableCommand *>(other)); if (!that || that->id() != id()) return false; m_disabled = that->m_disabled; setText(that->text()); return true; */ } UndoParameterCommand::UndoParameterCommand(const QString &name, FilterController *controller, int row, Mlt::Properties &before, const QString &desc, QUndoCommand *parent) : QUndoCommand(parent) , m_filterController(controller) , m_row(row) , m_producerUuid(MLT.ensureHasUuid(*controller->attachedModel()->producer())) , m_firstRedo(true) { if (desc.isEmpty()) { setText(QObject::tr("Change %1 filter").arg(name)); } else { setText(QObject::tr("Change %1 filter: %2").arg(name).arg(desc)); } m_before.inherit(before); Mlt::Service *service = controller->attachedModel()->getService(m_row); m_after.inherit(*service); } void UndoParameterCommand::update(const QString &propertyName) { Mlt::Service *service = m_filterController->attachedModel()->getService(m_row); m_after.pass_property(*service, propertyName.toUtf8().constData()); } void UndoParameterCommand::redo() { LOG_DEBUG() << text(); if (m_firstRedo) { m_firstRedo = false; } else { Mlt::Producer producer = findProducer(m_producerUuid); Q_ASSERT(producer.is_valid()); if (producer.is_valid() && m_filterController) { Mlt::Service service = m_filterController->attachedModel()->doGetService(producer, m_row); service.inherit(m_after); m_filterController->onUndoOrRedo(service); } } } void UndoParameterCommand::undo() { LOG_DEBUG() << text(); Mlt::Producer producer = findProducer(m_producerUuid); Q_ASSERT(producer.is_valid()); if (producer.is_valid() && m_filterController) { Mlt::Service service = m_filterController->attachedModel()->doGetService(producer, m_row); service.inherit(m_before); m_filterController->onUndoOrRedo(service); } } bool UndoParameterCommand::mergeWith(const QUndoCommand *other) { UndoParameterCommand *that = const_cast<UndoParameterCommand *> (static_cast<const UndoParameterCommand *>(other)); LOG_DEBUG() << "this filter" << m_row << "that filter" << that->m_row; if (that->id() != id() || that->m_row != m_row || that->m_producerUuid != m_producerUuid || that->text() != text()) return false; m_after = that->m_after; return true; } } // namespace Filter
11,849
C++
.cpp
377
25.883289
119
0.631455
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,262
scopecontroller.cpp
mltframework_shotcut/src/controllers/scopecontroller.cpp
/* * Copyright (c) 2015-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "scopecontroller.h" #include "widgets/scopes/audioloudnessscopewidget.h" #include "widgets/scopes/audiopeakmeterscopewidget.h" #include "widgets/scopes/audiospectrumscopewidget.h" #include "widgets/scopes/audiosurroundscopewidget.h" #include "widgets/scopes/audiovectorscopewidget.h" #include "widgets/scopes/audiowaveformscopewidget.h" #include "widgets/scopes/videohistogramscopewidget.h" #include "widgets/scopes/videorgbparadescopewidget.h" #include "widgets/scopes/videorgbwaveformscopewidget.h" #include "widgets/scopes/videovectorscopewidget.h" #include "widgets/scopes/videowaveformscopewidget.h" #include "widgets/scopes/videozoomscopewidget.h" #include "docks/scopedock.h" #include <Logger.h> #include <QMainWindow> #include <QMenu> ScopeController::ScopeController(QMainWindow *mainWindow, QMenu *menu) : QObject(mainWindow) { LOG_DEBUG() << "begin"; QMenu *scopeMenu = menu->addMenu(tr("Scopes")); createScopeDock<AudioLoudnessScopeWidget>(mainWindow, scopeMenu); createScopeDock<AudioPeakMeterScopeWidget>(mainWindow, scopeMenu); createScopeDock<AudioSpectrumScopeWidget>(mainWindow, scopeMenu); createScopeDock<AudioSurroundScopeWidget>(mainWindow, scopeMenu); createScopeDock<AudioVectorScopeWidget>(mainWindow, scopeMenu); createScopeDock<AudioWaveformScopeWidget>(mainWindow, scopeMenu); createScopeDock<VideoHistogramScopeWidget>(mainWindow, scopeMenu); createScopeDock<VideoRgbParadeScopeWidget>(mainWindow, scopeMenu); createScopeDock<VideoRgbWaveformScopeWidget>(mainWindow, scopeMenu); createScopeDock<VideoVectorScopeWidget>(mainWindow, scopeMenu); createScopeDock<VideoWaveformScopeWidget>(mainWindow, scopeMenu); createScopeDock<VideoZoomScopeWidget>(mainWindow, scopeMenu); LOG_DEBUG() << "end"; } template<typename ScopeTYPE> void ScopeController::createScopeDock(QMainWindow *mainWindow, QMenu *menu) { ScopeWidget *scopeWidget = new ScopeTYPE(); ScopeDock *scopeDock = new ScopeDock(this, scopeWidget); scopeDock->hide(); menu->addAction(scopeDock->toggleViewAction()); mainWindow->addDockWidget(Qt::RightDockWidgetArea, scopeDock); }
2,925
C++
.cpp
61
44.180328
91
0.783992
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
13,263
filtercontroller.cpp
mltframework_shotcut/src/controllers/filtercontroller.cpp
/* * Copyright (c) 2014-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "shotcut_mlt_properties.h" #include "filtercontroller.h" #include <QQmlEngine> #include <QDir> #include <Logger.h> #include <QQmlComponent> #include <QTimerEvent> #include "mltcontroller.h" #include "settings.h" #include "qmltypes/qmlmetadata.h" #include "qmltypes/qmlutilities.h" #include "qmltypes/qmlfilter.h" #include "qmltypes/qmlapplication.h" #include <MltLink.h> FilterController::FilterController(QObject *parent) : QObject(parent), m_metadataModel(this), m_attachedModel(this), m_currentFilterIndex(QmlFilter::NoCurrentFilter) { startTimer(0); connect(&m_attachedModel, SIGNAL(changed()), this, SLOT(handleAttachedModelChange())); connect(&m_attachedModel, SIGNAL(modelAboutToBeReset()), this, SLOT(handleAttachedModelAboutToReset())); connect(&m_attachedModel, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)), this, SLOT(handleAttachedRowsAboutToBeRemoved(const QModelIndex &, int, int))); connect(&m_attachedModel, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SLOT(handleAttachedRowsRemoved(const QModelIndex &, int, int))); connect(&m_attachedModel, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(handleAttachedRowsInserted(const QModelIndex &, int, int))); connect(&m_attachedModel, SIGNAL(duplicateAddFailed(int)), this, SLOT(handleAttachDuplicateFailed(int))); } void FilterController::loadFilterMetadata() { QScopedPointer<Mlt::Properties> mltFilters(MLT.repository()->filters()); QScopedPointer<Mlt::Properties> mltLinks(MLT.repository()->links()); QScopedPointer<Mlt::Properties> mltProducers(MLT.repository()->producers()); QDir dir = QmlUtilities::qmlDir(); dir.cd("filters"); foreach (QString dirName, dir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Executable)) { QDir subdir = dir; subdir.cd(dirName); subdir.setFilter(QDir::Files | QDir::NoDotAndDotDot | QDir::Readable); subdir.setNameFilters(QStringList("meta*.qml")); foreach (QString fileName, subdir.entryList()) { LOG_DEBUG() << "reading filter metadata" << dirName << fileName; QQmlComponent component(QmlUtilities::sharedEngine(), subdir.absoluteFilePath(fileName)); QmlMetadata *meta = qobject_cast<QmlMetadata *>(component.create()); if (meta) { QScopedPointer<Mlt::Properties> mltMetadata(MLT.repository()->metadata(mlt_service_filter_type, meta->mlt_service().toLatin1().constData())); QString version; if (mltMetadata && mltMetadata->is_valid() && mltMetadata->get("version")) { version = QString::fromLatin1(mltMetadata->get("version")); if (version.startsWith("lavfi")) version.remove(0, 5); } // Check if mlt_service is available. if (mltFilters->get_data(meta->mlt_service().toLatin1().constData()) && // Check if MLT glaxnimate producer is available if needed ("maskGlaxnimate" != meta->objectName() || mltProducers->get_data("glaxnimate")) && (version.isEmpty() || meta->isMltVersion(version))) { LOG_DEBUG() << "added filter" << meta->name(); meta->loadSettings(); meta->setPath(subdir); meta->setParent(0); addMetadata(meta); // Check if a keyframes minimum version is required. if (!version.isEmpty() && meta->keyframes()) { meta->setProperty("version", version); meta->keyframes()->checkVersion(version); } } else if (meta->type() == QmlMetadata::Link && mltLinks->get_data(meta->mlt_service().toLatin1().constData())) { LOG_DEBUG() << "added link" << meta->name(); meta->loadSettings(); meta->setPath(subdir); meta->setParent(0); addMetadata(meta); } if (meta->isDeprecated()) meta->setName(meta->name() + " " + tr("(DEPRECATED)")); } else if (!meta) { LOG_WARNING() << component.errorString(); } } }; } QmlMetadata *FilterController::metadata(const QString &id) { QmlMetadata *meta = 0; int rowCount = m_metadataModel.sourceRowCount(); for (int i = 0; i < rowCount; i++) { QmlMetadata *tmpMeta = m_metadataModel.getFromSource(i); if (tmpMeta->uniqueId() == id) { meta = tmpMeta; break; } } return meta; } QmlMetadata *FilterController::metadataForService(Mlt::Service *service) { QmlMetadata *meta = nullptr; QString uniqueId = service->get(kShotcutFilterProperty); // Fallback to mlt_service for legacy filters if (uniqueId.isEmpty()) { uniqueId = service->get("mlt_service"); } return metadata(uniqueId); } bool FilterController::isOutputTrackSelected() const { return m_attachedModel.producer() && m_attachedModel.producer()->is_valid() && mlt_service_tractor_type == m_attachedModel.producer()->type() && !m_attachedModel.producer()->get(kShotcutTransitionProperty) && m_attachedModel.rowCount() == 0; } void FilterController::loadFilterSets() { auto dir = QmlApplication::dataDir(); if (dir.cd("shotcut") && dir.cd("filter-sets")) { QStringList entries = dir.entryList(QDir::Files | QDir::Readable); for (const auto &s : entries) { auto meta = new QmlMetadata; meta->setType(QmlMetadata::FilterSet); if (s == QUrl::toPercentEncoding(QUrl::fromPercentEncoding(s.toUtf8()))) meta->setName(QUrl::fromPercentEncoding(s.toUtf8())); else meta->setName(s); meta->set_mlt_service("stock"); meta->loadSettings(); addMetadata(meta); } } dir = Settings.appDataLocation(); if (dir.cd("filter-sets")) { QStringList entries = dir.entryList(QDir::Files | QDir::Readable); for (const auto &s : entries) { auto meta = new QmlMetadata; meta->setType(QmlMetadata::FilterSet); if (s == QUrl::toPercentEncoding(QUrl::fromPercentEncoding(s.toUtf8()))) meta->setName(QUrl::fromPercentEncoding(s.toUtf8())); else meta->setName(s); meta->loadSettings(); addMetadata(meta); } } } void FilterController::onUndoOrRedo(Mlt::Service &service) { MLT.refreshConsumer(); if (m_currentFilter && m_mltService.is_valid() && service.get_service() == m_mltService.get_service()) { emit undoOrRedo(); QMetaObject::invokeMethod(this, "setCurrentFilter", Qt::QueuedConnection, Q_ARG(int, m_currentFilterIndex)); } } void FilterController::timerEvent(QTimerEvent *event) { loadFilterMetadata(); loadFilterSets(); killTimer(event->timerId()); } MetadataModel *FilterController::metadataModel() { return &m_metadataModel; } AttachedFiltersModel *FilterController::attachedModel() { return &m_attachedModel; } void FilterController::setProducer(Mlt::Producer *producer) { m_attachedModel.setProducer(producer); if (producer && producer->is_valid()) { m_metadataModel.updateFilterMask(!MLT.isTrackProducer(*producer), producer->type() == mlt_service_chain_type, producer->type() == mlt_service_playlist_type, producer->type() == mlt_service_tractor_type); } else { setCurrentFilter(QmlFilter::DeselectCurrentFilter); } } void FilterController::setCurrentFilter(int attachedIndex) { if (attachedIndex == m_currentFilterIndex) { return; } m_currentFilterIndex = attachedIndex; // VUIs may instruct MLT filters to not render if they are doing the rendering // theirself, for example, Text: Rich. Component.onDestruction is not firing. if (m_mltService.is_valid()) { if (m_mltService.get_int("_hide")) { m_mltService.clear("_hide"); MLT.refreshConsumer(); } } QmlMetadata *meta = m_attachedModel.getMetadata(m_currentFilterIndex); QmlFilter *filter = 0; if (meta) { emit currentFilterChanged(nullptr, nullptr, QmlFilter::NoCurrentFilter); m_mltService = m_attachedModel.getService(m_currentFilterIndex); if (!m_mltService.is_valid()) return; filter = new QmlFilter(m_mltService, meta); filter->setIsNew(m_mltService.get_int(kNewFilterProperty)); m_mltService.clear(kNewFilterProperty); connect(filter, SIGNAL(changed(QString)), SLOT(onQmlFilterChanged(const QString &))); } emit currentFilterChanged(filter, meta, m_currentFilterIndex); m_currentFilter.reset(filter); if (filter && !m_attachedModel.isSourceClip()) { filter->startUndoTracking(); } } void FilterController::onFadeInChanged() { if (m_currentFilter) { QString name = m_currentFilter->objectNameOrService(); if (name.startsWith("fadeIn")) { emit m_currentFilter->changed(); emit m_currentFilter->animateInChanged(); } } } void FilterController::onFadeOutChanged() { if (m_currentFilter) { QString name = m_currentFilter->objectNameOrService(); if (name.startsWith("fadeOut")) { emit m_currentFilter->changed(); emit m_currentFilter->animateOutChanged(); } } } void FilterController::onServiceInChanged(int delta, Mlt::Service *service) { if (delta && m_currentFilter && (!service || m_currentFilter->service().get_service() == service->get_service())) { emit m_currentFilter->inChanged(delta); } } void FilterController::onServiceOutChanged(int delta, Mlt::Service *service) { if (delta && m_currentFilter && (!service || m_currentFilter->service().get_service() == service->get_service())) { emit m_currentFilter->outChanged(delta); } } void FilterController::handleAttachedModelChange() { if (m_currentFilter) { emit m_currentFilter->changed("disable"); } } void FilterController::handleAttachedModelAboutToReset() { setCurrentFilter(QmlFilter::NoCurrentFilter); } void FilterController::handleAttachedRowsRemoved(const QModelIndex &, int first, int) { m_currentFilterIndex = QmlFilter::DeselectCurrentFilter; // Force update setCurrentFilter(qBound(0, first, qMax(m_attachedModel.rowCount() - 1, 0))); } void FilterController::handleAttachedRowsInserted(const QModelIndex &, int first, int) { m_currentFilterIndex = QmlFilter::DeselectCurrentFilter; // Force update setCurrentFilter(qBound(0, first, qMax(m_attachedModel.rowCount() - 1, 0))); } void FilterController::handleAttachDuplicateFailed(int index) { const QmlMetadata *meta = m_attachedModel.getMetadata(index); emit statusChanged(tr("Only one %1 filter is allowed.").arg(meta->name())); setCurrentFilter(index); } void FilterController::onQmlFilterChanged(const QString &name) { if (name == "disable") { QModelIndex index = m_attachedModel.index(m_currentFilterIndex); emit m_attachedModel.dataChanged(index, index, QVector<int>() << Qt::CheckStateRole); } emit filterChanged(&m_mltService); } void FilterController::removeCurrent() { if (m_currentFilterIndex > QmlFilter::NoCurrentFilter) m_attachedModel.remove(m_currentFilterIndex); } void FilterController::onProducerChanged() { emit m_attachedModel.trackTitleChanged(); } void FilterController::addMetadata(QmlMetadata *meta) { m_metadataModel.add(meta); } void FilterController::handleAttachedRowsAboutToBeRemoved(const QModelIndex &parent, int first, int last) { auto filter = m_attachedModel.getService(first); m_motionTrackerModel.remove(m_motionTrackerModel.keyForFilter(filter)); } void FilterController::addOrEditFilter(Mlt::Filter *filter, const QStringList &key_properties) { int rows = m_attachedModel.rowCount(); int serviceIndex = -1; for (int i = 0; i < rows; i++) { QScopedPointer<Mlt::Service> service(m_attachedModel.getService(i)); bool servicesMatch = true; if (metadataForService(service.data())->uniqueId() != metadataForService(filter)->uniqueId()) { continue; } for (auto &k : key_properties) { const auto keyByteArray = k.toUtf8(); const char *key = keyByteArray.constData(); if (!service->property_exists(key) || !service->property_exists(key)) { servicesMatch = false; break; } else if (QString(service->get(key)) != QString(filter->get(key))) { servicesMatch = false; break; } } if (servicesMatch) { serviceIndex = i; break; } } if (serviceIndex < 0) { serviceIndex = m_attachedModel.addService(filter); } setCurrentFilter(serviceIndex); }
14,432
C++
.cpp
351
32.754986
132
0.634739
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,264
abstractjob.cpp
mltframework_shotcut/src/jobs/abstractjob.cpp
/* * Copyright (c) 2012-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "abstractjob.h" #include "postjobaction.h" #include <QApplication> #include <QTimer> #include <QAction> #include <Logger.h> #ifdef Q_OS_WIN #include <windows.h> #else #include <signal.h> #endif AbstractJob::AbstractJob(const QString &name, QThread::Priority priority) : QProcess(0) , m_item(0) , m_ran(false) , m_killed(false) , m_label(name) , m_startingPercent(0) , m_priority(priority) { setObjectName(name); connect(this, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(onFinished(int, QProcess::ExitStatus))); connect(this, SIGNAL(readyRead()), this, SLOT(onReadyRead())); connect(this, SIGNAL(started()), this, SLOT(onStarted())); connect(this, SIGNAL(progressUpdated(QStandardItem *, int)), SLOT(onProgressUpdated(QStandardItem *, int))); m_actionPause = new QAction(tr("Pause This Job"), this); m_standardActions << m_actionPause; m_actionResume = new QAction(tr("Resume This Job"), this); m_actionResume->setEnabled(false); m_standardActions << m_actionResume; connect(m_actionPause, &QAction::triggered, this, &AbstractJob::pause); connect(m_actionResume, &QAction::triggered, this, &AbstractJob::resume); } void AbstractJob::start() { m_killed = false; m_ran = true; m_estimateTime.start(); m_totalTime.start(); emit progressUpdated(m_item, 0); } void AbstractJob::setStandardItem(QStandardItem *item) { m_item = item; } QStandardItem *AbstractJob::standardItem() { return m_item; } bool AbstractJob::ran() const { return m_ran; } bool AbstractJob::stopped() const { return m_killed; } void AbstractJob::appendToLog(const QString &s) { if (m_log.size() < 100 * 1024 * 1024 /* MiB */) { m_log.append(s); } } QString AbstractJob::log() const { return m_log; } void AbstractJob::setLabel(const QString &label) { m_label = label; } QTime AbstractJob::estimateRemaining(int percent) { QTime result; if (percent) { int averageMs = m_estimateTime.elapsed() / qMax(1, percent - qMax(0, m_startingPercent)); result = QTime::fromMSecsSinceStartOfDay(averageMs * (100 - percent)); } return result; } void AbstractJob::setPostJobAction(PostJobAction *action) { m_postJobAction.reset(action); } bool AbstractJob::paused() const { return !m_actionPause->isEnabled(); } void AbstractJob::start(const QString &program, const QStringList &arguments) { QString prog = program; QStringList args = arguments; #ifndef Q_OS_WIN if (m_priority == QThread::LowPriority || m_priority == QThread::HighPriority) { args.prepend(program); args.prepend(m_priority == QThread::LowPriority ? "3" : "-3"); args.prepend("-n"); prog = "nice"; } #endif QProcess::start(prog, args); AbstractJob::start(); m_actionPause->setEnabled(true); m_actionResume->setEnabled(false); } void AbstractJob::stop() { if (paused()) { #ifdef Q_OS_WIN ::DebugActiveProcessStop(QProcess::processId()); #else ::kill(QProcess::processId(), SIGCONT); #endif } closeWriteChannel(); terminate(); QTimer::singleShot(2000, this, SLOT(kill())); m_killed = true; m_actionPause->setEnabled(false); m_actionResume->setEnabled(false); } void AbstractJob::pause() { m_actionPause->setEnabled(false); m_actionResume->setEnabled(true); #ifdef Q_OS_WIN ::DebugActiveProcess(QProcess::processId()); #else ::kill(QProcess::processId(), SIGSTOP); #endif emit progressUpdated(m_item, -1); } void AbstractJob::resume() { m_actionPause->setEnabled(true); m_actionResume->setEnabled(false); m_startingPercent = -1; #ifdef Q_OS_WIN ::DebugActiveProcessStop(QProcess::processId()); #else ::kill(QProcess::processId(), SIGCONT); #endif emit progressUpdated(m_item, 0); } void AbstractJob::onFinished(int exitCode, QProcess::ExitStatus exitStatus) { const QTime &time = QTime::fromMSecsSinceStartOfDay(m_totalTime.elapsed()); if (isOpen()) { m_log.append(readAll()); } if (exitStatus == QProcess::NormalExit && exitCode == 0 && !m_killed) { if (m_postJobAction) { m_postJobAction->doAction(); } LOG_INFO() << "job succeeeded"; m_log.append(QStringLiteral("Completed successfully in %1\n").arg(time.toString())); emit progressUpdated(m_item, 100); emit finished(this, true); } else if (m_killed) { LOG_INFO() << "job stopped"; m_log.append(QStringLiteral("Stopped by user at %1\n").arg(time.toString())); emit finished(this, false); } else { LOG_INFO() << "job failed with" << exitCode; m_log.append(QStringLiteral("Failed with exit code %1\n").arg(exitCode)); emit finished(this, false); } } void AbstractJob::onReadyRead() { QString msg; do { msg = readLine(); appendToLog(msg); } while (!msg.isEmpty()); } void AbstractJob::onStarted() { #ifdef Q_OS_WIN qint64 processId = QProcess::processId(); HANDLE processHandle = OpenProcess(PROCESS_SET_INFORMATION, FALSE, processId); if (processHandle) { switch (m_priority) { case QThread::LowPriority: SetPriorityClass(processHandle, BELOW_NORMAL_PRIORITY_CLASS); break; case QThread::HighPriority: SetPriorityClass(processHandle, ABOVE_NORMAL_PRIORITY_CLASS); break; default: SetPriorityClass(processHandle, NORMAL_PRIORITY_CLASS); } CloseHandle(processHandle); } #endif } void AbstractJob::onProgressUpdated(QStandardItem *, int percent) { // Start timer on first reported percentage > 0. if (percent > 0 && (percent == 1 || m_startingPercent < 0)) { m_estimateTime.restart(); m_startingPercent = percent; } }
6,753
C++
.cpp
222
25.509009
109
0.664054
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
13,265
gopro2gpxjob.cpp
mltframework_shotcut/src/jobs/gopro2gpxjob.cpp
/* * Copyright (c) 2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "gopro2gpxjob.h" #include "mainwindow.h" #include "dialogs/textviewerdialog.h" #include "util.h" #include <QAction> #include <QApplication> #include <QFileInfo> #include <QDir> #include <Logger.h> GoPro2GpxJob::GoPro2GpxJob(const QString &name, const QStringList &args) : AbstractJob(name) { m_args.append(args); setLabel(QStringLiteral("%1 %2").arg(tr("Export GPX"), Util::baseName(name))); } void GoPro2GpxJob::start() { QString shotcutPath = qApp->applicationDirPath(); QFileInfo gopro2gpxPath(shotcutPath, "gopro2gpx"); setReadChannel(QProcess::StandardOutput); LOG_DEBUG() << gopro2gpxPath.absoluteFilePath() + " " + m_args.join(' '); AbstractJob::start(gopro2gpxPath.absoluteFilePath(), m_args); }
1,443
C++
.cpp
39
34.692308
82
0.747143
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,266
ffmpegjob.cpp
mltframework_shotcut/src/jobs/ffmpegjob.cpp
/* * Copyright (c) 2016-2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "ffmpegjob.h" #include "mainwindow.h" #include "dialogs/textviewerdialog.h" #include "util.h" #include <MltProperties.h> #include <QAction> #include <QApplication> #include <QFileInfo> #include <QDir> #include <QRegularExpression> #include <Logger.h> FfmpegJob::FfmpegJob(const QString &name, const QStringList &args, bool isOpenLog, QThread::Priority priority) : AbstractJob(name, priority) , m_outputMsgRead(false) , m_totalFrames(0) , m_previousPercent(0) , m_isOpenLog(isOpenLog) { QAction *action = new QAction(tr("Open"), this); action->setData("Open"); connect(action, SIGNAL(triggered()), this, SLOT(onOpenTriggered())); m_successActions << action; m_args.append(args); setLabel(tr("Check %1").arg(Util::baseName(name))); } FfmpegJob::~FfmpegJob() { if (objectName().contains("proxies") && objectName().contains(".pending.")) { QFile::remove(objectName()); } } void FfmpegJob::start() { QString shotcutPath = qApp->applicationDirPath(); QFileInfo ffmpegPath(shotcutPath, "ffmpeg"); setReadChannel(QProcess::StandardError); LOG_DEBUG() << ffmpegPath.absoluteFilePath() + " " + m_args.join(' '); AbstractJob::start(ffmpegPath.absoluteFilePath(), m_args); } void FfmpegJob::stop() { write("q"); QTimer::singleShot(3000, this, [this]() { AbstractJob::stop(); }); } void FfmpegJob::onOpenTriggered() { if (m_isOpenLog) { TextViewerDialog dialog(&MAIN); dialog.setWindowTitle(tr("FFmpeg Log")); dialog.setText(log()); dialog.exec(); } else { MAIN.open(objectName().toUtf8().constData()); } } void FfmpegJob::onReadyRead() { QString msg; do { msg = readLine(); if (!msg.startsWith("frame=") && (!msg.trimmed().isEmpty())) { appendToLog(msg); } if (msg.contains("Duration:")) { m_duration = msg.mid(msg.indexOf("Duration:") + 9); m_duration = m_duration.left(m_duration.indexOf(',')); emit progressUpdated(m_item, 0); } else if (!m_outputMsgRead) { // Wait for the "Output" then read the output fps to calculate number of frames. if (msg.contains("Output ")) { m_outputMsgRead = true; } } if (!m_totalFrames && msg.contains(" fps")) { Mlt::Profile profile; QRegularExpression re("(\\d+|\\d+.\\d+) fps"); QRegularExpressionMatch match = re.match(msg); if (match.hasMatch()) { QString fps = match.captured(1); profile.set_frame_rate(qRound(fps.toFloat() * 1000), 1000); } else { profile.set_frame_rate(25, 1); } Mlt::Properties props; props.set("_profile", profile.get_profile(), 0); m_totalFrames = props.time_to_frames(m_duration.toLatin1().constData()); } else if (msg.startsWith("frame=") && m_totalFrames > 0) { msg = msg.mid(msg.indexOf("frame=") + 6); msg = msg.left(msg.indexOf(" fps")); int frame = msg.toInt(); int percent = qRound(frame * 100.0 / m_totalFrames); if (percent != m_previousPercent) { emit progressUpdated(m_item, percent); m_previousPercent = percent; } } } while (!msg.isEmpty()); }
4,140
C++
.cpp
117
28.91453
92
0.620672
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
13,267
qimagejob.cpp
mltframework_shotcut/src/jobs/qimagejob.cpp
/* * Copyright (c) 2020-2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "qimagejob.h" #include "util.h" #include <QImage> #include <QImageReader> #include <QRunnable> #include <QtConcurrent/QtConcurrent> QImageJob::QImageJob(const QString &destFilePath, const QString &srcFilePath, const int height) : AbstractJob(srcFilePath) , m_srcFilePath(srcFilePath) , m_destFilePath(destFilePath) , m_height(height) { setLabel(tr("Make proxy for %1").arg(Util::baseName(srcFilePath))); } QImageJob::~QImageJob() { if (m_destFilePath.contains("proxies") && m_destFilePath.contains(".pending.")) { QFile::remove(m_destFilePath); } } void QImageJob::start() { AbstractJob::start(); auto result = QtConcurrent::run([ = ]() { appendToLog(QStringLiteral("Reading source image \"%1\"\n").arg(m_srcFilePath)); QImageReader reader; reader.setAutoTransform(true); reader.setDecideFormatFromContent(true); reader.setFileName(m_srcFilePath); QImage image(reader.read()); if (!image.isNull()) { image = image.scaledToHeight(m_height, Qt::SmoothTransformation); if (image.save(m_destFilePath)) { appendToLog(QStringLiteral("Successfully saved image as \"%1\"\n").arg(m_destFilePath)); QMetaObject::invokeMethod(this, "onFinished", Qt::QueuedConnection, Q_ARG(int, 0)); } else { appendToLog(QStringLiteral("Failed to save image as \"%1\"\n").arg(m_destFilePath)); QMetaObject::invokeMethod(this, "onFinished", Qt::QueuedConnection, Q_ARG(int, 1)); } } else { appendToLog(QStringLiteral("Failed to read source image \"%1\"\n").arg(m_srcFilePath)); QMetaObject::invokeMethod(this, "onFinished", Qt::QueuedConnection, Q_ARG(int, 1)); } }); }
2,510
C++
.cpp
61
35.622951
104
0.68126
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
13,268
meltjob.cpp
mltframework_shotcut/src/jobs/meltjob.cpp
/* * Copyright (c) 2012-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "meltjob.h" #include <QFile> #include <QFileInfo> #include <QDir> #include <QIODevice> #include <QApplication> #include <QAction> #include <QDialog> #include <QDir> #include <QTimer> #include <Logger.h> #include "mainwindow.h" #include "dialogs/textviewerdialog.h" #include "util.h" MeltJob::MeltJob(const QString &name, const QString &xml, int frameRateNum, int frameRateDen, QThread::Priority priority) : AbstractJob(name, priority) , m_isStreaming(false) , m_previousPercent(0) , m_currentFrame(0) , m_useMultiConsumer(false) { if (!xml.isEmpty()) { QAction *action = new QAction(tr("View XML"), this); action->setToolTip(tr("View the MLT XML for this job")); connect(action, SIGNAL(triggered()), this, SLOT(onViewXmlTriggered())); m_standardActions << action; m_xml.reset(Util::writableTemporaryFile(name, "shotcut-XXXXXX.mlt")); m_xml->open(); m_xml->write(xml.toUtf8()); m_xml->close(); } else { // Not an EncodeJob QAction *action = new QAction(tr("Open"), this); action->setData("Open"); action->setToolTip(tr("Open the output file in the Shotcut player")); connect(action, SIGNAL(triggered()), this, SLOT(onOpenTiggered())); m_successActions << action; action = new QAction(tr("Show In Folder"), this); action->setToolTip(tr("Show In Folder")); connect(action, SIGNAL(triggered()), this, SLOT(onShowFolderTriggered())); m_successActions << action; } if (frameRateNum > 0 && frameRateDen > 0) m_profile.set_frame_rate(frameRateNum, frameRateDen); } void MeltJob::onOpenTiggered() { MAIN.open(objectName().toUtf8().constData()); } void MeltJob::onShowFolderTriggered() { Util::showInFolder(objectName()); } MeltJob::MeltJob(const QString &name, const QString &xml, const QStringList &args, int frameRateNum, int frameRateDen) : MeltJob(name, xml, frameRateNum, frameRateDen) { m_args = args; } MeltJob::MeltJob(const QString &name, const QStringList &args, int frameRateNum, int frameRateDen) : MeltJob(name, QString(), frameRateNum, frameRateDen) { m_args = args; } MeltJob::~MeltJob() { LOG_DEBUG() << "begin"; } void MeltJob::start() { if (m_args.isEmpty() && !m_xml) { AbstractJob::start(); LOG_ERROR() << "the job XML is empty!"; appendToLog("Error: the job XML is empty!\n"); QTimer::singleShot(0, this, [ = ]() { emit finished(this, false); }); return; } QString shotcutPath = qApp->applicationDirPath(); #if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) QFileInfo meltPath(shotcutPath, "melt-7"); #else QFileInfo meltPath(shotcutPath, "melt"); #endif setReadChannel(QProcess::StandardError); QStringList args; args << "-verbose"; args << "-progress2"; args << "-abort"; if (!m_xml.isNull()) { if (m_useMultiConsumer) { args << "xml:" + QUrl::toPercentEncoding(xmlPath()) + "?multi:1"; } else { args << "xml:" + QUrl::toPercentEncoding(xmlPath()); } } if (m_args.size() > 0) { args.append(m_args); } if (m_in > -1) { args << QStringLiteral("in=%1").arg(m_in); } if (m_out > -1) { args << QStringLiteral("out=%1").arg(m_out); } LOG_DEBUG() << meltPath.absoluteFilePath() + " " + args.join(' '); #ifndef Q_OS_MAC QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); // These environment variables fix rich text rendering for high DPI // fractional or otherwise. env.insert("QT_AUTO_SCREEN_SCALE_FACTOR", "1"); env.insert("QT_SCALE_FACTOR_ROUNDING_POLICY", "PassThrough"); setProcessEnvironment(env); #endif #ifdef Q_OS_WIN if (m_isStreaming) args << "-getc"; #endif AbstractJob::start(meltPath.absoluteFilePath(), args); } QString MeltJob::xml() { m_xml->open(); QString s(m_xml->readAll()); m_xml->close(); return s; } void MeltJob::setIsStreaming(bool streaming) { m_isStreaming = streaming; } void MeltJob::setUseMultiConsumer(bool multi) { m_useMultiConsumer = multi; } void MeltJob::setInAndOut(int in, int out) { m_in = in; m_out = out; } void MeltJob::onViewXmlTriggered() { TextViewerDialog dialog(&MAIN, true); dialog.setWindowTitle(tr("MLT XML")); dialog.setText(xml()); dialog.exec(); } void MeltJob::onReadyRead() { QString msg; do { msg = readLine(); int index = msg.indexOf("Frame:"); if (index > -1) { index += 6; int comma = msg.indexOf(',', index); m_currentFrame = msg.mid(index, comma - index).toInt(); } index = msg.indexOf("percentage:"); if (index > -1) { int percent = msg.mid(index + 11).toInt(); if (percent != m_previousPercent) { emit progressUpdated(m_item, percent); QCoreApplication::processEvents(); m_previousPercent = percent; } } else { appendToLog(msg); } } while (!msg.isEmpty()); } void MeltJob::onFinished(int exitCode, QProcess::ExitStatus exitStatus) { AbstractJob::onFinished(exitCode, exitStatus); if (exitStatus != QProcess::NormalExit && exitCode != 0 && !stopped()) { Mlt::Producer producer(m_profile, "colour:"); QString time = QString::fromLatin1(producer.frames_to_time(m_currentFrame)); emit finished(this, false, time); } }
6,302
C++
.cpp
197
26.862944
100
0.64247
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
13,269
ffprobejob.cpp
mltframework_shotcut/src/jobs/ffprobejob.cpp
/* * Copyright (c) 2016 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "ffprobejob.h" #include "mainwindow.h" #include "dialogs/textviewerdialog.h" #include "util.h" #include <QAction> #include <QApplication> #include <QFileInfo> #include <QDir> #include <Logger.h> FfprobeJob::FfprobeJob(const QString &name, const QStringList &args) : AbstractJob(name) { m_args.append(args); } FfprobeJob::~FfprobeJob() { } void FfprobeJob::start() { QString shotcutPath = qApp->applicationDirPath(); QFileInfo ffprobePath(shotcutPath, "ffprobe"); setReadChannel(QProcess::StandardOutput); LOG_DEBUG() << ffprobePath.absoluteFilePath() + " " + m_args.join(' '); AbstractJob::start(ffprobePath.absoluteFilePath(), m_args); } void FfprobeJob::onFinished(int exitCode, QProcess::ExitStatus exitStatus) { AbstractJob::onFinished(exitCode, exitStatus); if (exitStatus == QProcess::NormalExit && exitCode == 0) { TextViewerDialog dialog(&MAIN); dialog.setWindowTitle(tr("More Information")); dialog.setText(log().replace("\\:", ":")); dialog.exec(); } deleteLater(); }
1,764
C++
.cpp
52
31.038462
76
0.729619
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
true
false
false
true
false
false
13,270
encodejob.cpp
mltframework_shotcut/src/jobs/encodejob.cpp
/* * Copyright (c) 2012-2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "encodejob.h" #include <QAction> #include <QUrl> #include <QDesktopServices> #include <QFileInfo> #include <QFileDialog> #include <QTemporaryFile> #include <QDir> #include <QDomDocument> #include <QTextStream> #include "mainwindow.h" #include "settings.h" #include "jobqueue.h" #include "jobs/videoqualityjob.h" #include "util.h" #include "spatialmedia/spatialmedia.h" #include <Logger.h> EncodeJob::EncodeJob(const QString &name, const QString &xml, int frameRateNum, int frameRateDen, QThread::Priority priority) : MeltJob(name, xml, frameRateNum, frameRateDen, priority) { QAction *action = new QAction(tr("Open"), this); action->setData("Open"); action->setToolTip(tr("Open the output file in the Shotcut player")); connect(action, SIGNAL(triggered()), this, SLOT(onOpenTiggered())); m_successActions << action; action = new QAction(tr("Show In Folder"), this); action->setToolTip(tr("Show In Folder")); connect(action, SIGNAL(triggered()), this, SLOT(onShowFolderTriggered())); m_successActions << action; action = new QAction(tr("Measure Video Quality..."), this); connect(action, SIGNAL(triggered()), this, SLOT(onVideoQualityTriggered())); m_successActions << action; action = new QAction(tr("Set Equirectangular..."), this); connect(action, SIGNAL(triggered()), this, SLOT(onSpatialMediaTriggered())); m_successActions << action; } void EncodeJob::onVideoQualityTriggered() { // Get the location and file name for the report. QString directory = Settings.encodePath(); QString caption = tr("Video Quality Report"); QString nameFilter = tr("Text Documents (*.txt);;All Files (*)"); QString reportPath = QFileDialog::getSaveFileName(&MAIN, caption, directory, nameFilter, nullptr, Util::getFileDialogOptions()); if (!reportPath.isEmpty()) { QFileInfo fi(reportPath); if (fi.suffix().isEmpty()) reportPath += ".txt"; if (Util::warnIfNotWritable(reportPath, &MAIN, caption)) return; // Get temp file for the new XML. QScopedPointer<QTemporaryFile> tmp(Util::writableTemporaryFile(reportPath)); tmp->open(); // Generate the XML for the comparison. Mlt::Tractor tractor(MLT.profile()); Mlt::Producer original(MLT.profile(), xmlPath().toUtf8().constData()); Mlt::Producer encoded(MLT.profile(), objectName().toUtf8().constData()); Mlt::Transition vqm(MLT.profile(), "vqm"); if (original.is_valid() && encoded.is_valid() && vqm.is_valid()) { tractor.set_track(original, 0); tractor.set_track(encoded, 1); tractor.plant_transition(vqm); vqm.set("render", 0); MLT.saveXML(tmp->fileName(), &tractor, false /* without relative paths */, tmp.data()); tmp->close(); // Add consumer element to XML. QFile f1(tmp->fileName()); f1.open(QIODevice::ReadOnly); QDomDocument dom(tmp->fileName()); dom.setContent(&f1); f1.close(); QDomElement consumerNode = dom.createElement("consumer"); QDomNodeList profiles = dom.elementsByTagName("profile"); if (profiles.isEmpty()) dom.documentElement().insertAfter(consumerNode, dom.documentElement()); else dom.documentElement().insertAfter(consumerNode, profiles.at(profiles.length() - 1)); consumerNode.setAttribute("mlt_service", "null"); consumerNode.setAttribute("real_time", -1); consumerNode.setAttribute("terminate_on_pause", 1); // Create job and add it to the queue. JOBS.add(new VideoQualityJob(objectName(), dom.toString(2), reportPath, MLT.profile().frame_rate_num(), MLT.profile().frame_rate_den())); } } } void EncodeJob::onSpatialMediaTriggered() { // Get the location and file name for the report. QString caption = tr("Set Equirectangular Projection"); QFileInfo info(objectName()); QString directory = QStringLiteral("%1/%2 - ERP.%3") .arg(Settings.encodePath()) .arg(info.completeBaseName()) .arg(info.suffix()); QString filePath = QFileDialog::getSaveFileName(&MAIN, caption, directory, QString(), nullptr, Util::getFileDialogOptions()); if (!filePath.isEmpty()) { if (SpatialMedia::injectSpherical(objectName().toStdString(), filePath.toStdString())) { MAIN.showStatusMessage(tr("Successfully wrote %1").arg(QFileInfo(filePath).fileName())); } else { MAIN.showStatusMessage(tr("An error occurred saving the projection.")); } } } void EncodeJob::onFinished(int exitCode, QProcess::ExitStatus exitStatus) { if (exitStatus != QProcess::NormalExit && exitCode != 0 && !stopped()) { LOG_INFO() << "job failed with" << exitCode; appendToLog(QStringLiteral("Failed with exit code %1\n").arg(exitCode)); bool isParallel = false; // Parse the XML. m_xml->open(); QDomDocument dom(xmlPath()); dom.setContent(m_xml.data()); m_xml->close(); // Locate the consumer element. QDomNodeList consumers = dom.elementsByTagName("consumer"); for (int i = 0; i < consumers.length(); i++ ) { QDomElement consumer = consumers.at(i).toElement(); // If real_time is set for parallel. if (consumer.attribute("real_time").toInt() < -1) { isParallel = true; consumer.setAttribute("real_time", "-1"); } } if (isParallel) { QString message(tr("Export job failed; trying again without Parallel processing.")); MAIN.showStatusMessage(message); appendToLog(message.append("\n")); m_xml->open(); QTextStream textStream(m_xml.data()); dom.save(textStream, 2); m_xml->close(); MeltJob::start(); return; } } MeltJob::onFinished(exitCode, exitStatus); }
7,020
C++
.cpp
157
36.305732
106
0.631371
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
13,271
postjobaction.cpp
mltframework_shotcut/src/jobs/postjobaction.cpp
/* * Copyright (c) 2018-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "postjobaction.h" #include "mainwindow.h" #include "docks/playlistdock.h" #include "docks/subtitlesdock.h" #include "shotcut_mlt_properties.h" #include <Logger.h> // For file time functions in FilePropertiesPostJobAction::doAction(); #include <utime.h> #include <sys/stat.h> #include <QFile> void FilePropertiesPostJobAction::doAction() { // TODO: When QT 5.10 is available, use QFileDevice functions #ifdef Q_OS_WIN struct _stat srcTime; struct _utimbuf dstTime; _stat(m_srcFile.toUtf8().constData(), &srcTime); dstTime.actime = srcTime.st_atime; dstTime.modtime = srcTime.st_mtime; _utime(m_dstFile.toUtf8().constData(), &dstTime); #else struct stat srcTime; struct utimbuf dstTime; stat(m_srcFile.toUtf8().constData(), &srcTime); dstTime.actime = srcTime.st_atime; dstTime.modtime = srcTime.st_mtime; utime(m_dstFile.toUtf8().constData(), &dstTime); #endif } void OpenPostJobAction::doAction() { FilePropertiesPostJobAction::doAction(); if (!m_fileNameToRemove.isEmpty()) { QFile::remove(m_fileNameToRemove); } MAIN.open(m_dstFile); MAIN.playlistDock()->onAppendCutActionTriggered(); } void ReplaceOnePostJobAction::doAction() { FilePropertiesPostJobAction::doAction(); if (!m_fileNameToRemove.isEmpty()) { QFile::remove(m_fileNameToRemove); } Mlt::Producer newProducer(MLT.profile(), m_dstFile.toUtf8().constData()); if (newProducer.is_valid()) { Mlt::Producer *producer = MLT.setupNewProducer(&newProducer); producer->set_in_and_out(m_in, -1); MAIN.replaceInTimeline(m_uuid, *producer); delete producer; } } void ReplaceAllPostJobAction::doAction() { FilePropertiesPostJobAction::doAction(); Mlt::Producer newProducer(MLT.profile(), m_dstFile.toUtf8().constData()); if (newProducer.is_valid()) { Mlt::Producer *producer = MLT.setupNewProducer(&newProducer); MAIN.replaceAllByHash(m_hash, *producer); delete producer; } } void ProxyReplacePostJobAction::doAction() { FilePropertiesPostJobAction::doAction(); QFileInfo info(m_dstFile); QString newFileName = info.path() + "/" + info.baseName() + "." + info.suffix(); QFile::remove(newFileName); if (QFile::rename(m_dstFile, newFileName)) { Mlt::Producer newProducer(MLT.profile(), newFileName.toUtf8().constData()); if (newProducer.is_valid()) { Mlt::Producer *producer = MLT.setupNewProducer(&newProducer); producer->set(kIsProxyProperty, 1); producer->set(kOriginalResourceProperty, m_srcFile.toUtf8().constData()); MAIN.replaceAllByHash(m_hash, *producer, true); delete producer; } else { LOG_WARNING() << "proxy file is invalid" << newFileName; QFile::remove(m_dstFile); } } else { LOG_WARNING() << "failed to rename" << m_dstFile << "as" << newFileName; QFile::remove(m_dstFile); } } void ProxyFinalizePostJobAction::doAction() { FilePropertiesPostJobAction::doAction(); QFileInfo info(m_dstFile); QString newFileName = info.path() + "/" + info.baseName() + "." + info.suffix(); if (!QFile::rename(m_dstFile, newFileName)) { LOG_WARNING() << "failed to rename" << m_dstFile << "as" << newFileName; QFile::remove(m_dstFile); } } void ImportSrtPostJobAction::doAction() { m_dock->importSrtFromFile(m_srtFile, m_trackName, m_lang, m_includeNonspoken); }
4,211
C++
.cpp
115
32.052174
85
0.693513
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
13,272
whisperjob.cpp
mltframework_shotcut/src/jobs/whisperjob.cpp
/* * Copyright (c) 2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "whisperjob.h" #include "dialogs/textviewerdialog.h" #include <Logger.h> #include "mainwindow.h" #include <QApplication> #include <QDir> #include <QFileInfo> #include <QTimer> #include <QThread> WhisperJob::WhisperJob(const QString &name, const QString &iWavFile, const QString &oSrtFile, const QString &lang, bool translate, int maxLength, QThread::Priority priority) : AbstractJob(name, priority) , m_iWavFile(iWavFile) , m_oSrtFile(oSrtFile) , m_lang(lang) , m_translate(translate) , m_maxLength(maxLength) , m_previousPercent(0) { } WhisperJob::~WhisperJob() { LOG_DEBUG() << "begin"; } void WhisperJob::start() { QString whisperPath = Settings.whisperExe(); auto modelPath = Settings.whisperModel(); setReadChannel(QProcess::StandardOutput); setProcessChannelMode(QProcess::MergedChannels); QString of = m_oSrtFile; of.remove(".srt"); QStringList args; args << "-f" << m_iWavFile; args << "-m" << modelPath; args << "-l" << m_lang; if (m_translate) { args << "-tr"; } args << "-of" << of; args << "-osrt"; args << "-pp"; args << "-ml" << QString::number(m_maxLength); args << "-sow"; #if QT_POINTER_SIZE == 4 // Limit to 1 rendering thread on 32-bit process to reduce memory usage. auto threadCount = 1; #else auto threadCount = qMax(1, QThread::idealThreadCount() - 1); #endif args << "-t" << QString::number(threadCount); LOG_DEBUG() << whisperPath + " " + args.join(' '); AbstractJob::start(whisperPath, args); emit progressUpdated(m_item, 0); } void WhisperJob::onViewSrtTriggered() { QFile srtFile(m_oSrtFile); QString text = srtFile.readAll(); TextViewerDialog dialog(&MAIN, true); dialog.setWindowTitle(tr("SRT")); dialog.setText(text); dialog.exec(); } void WhisperJob::onReadyRead() { QString msg; do { msg = readLine(); if (!msg.isEmpty()) { int index = msg.indexOf("progress = "); if (index > -1) { QString num = msg.mid(index + 11).remove("%").trimmed(); int percent = num.toInt(); if (percent != m_previousPercent) { emit progressUpdated(m_item, percent); QCoreApplication::processEvents(); m_previousPercent = percent; } } appendToLog(msg); } } while (!msg.isEmpty()); }
3,219
C++
.cpp
101
26.50495
93
0.638442
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,273
videoqualityjob.cpp
mltframework_shotcut/src/jobs/videoqualityjob.cpp
/* * Copyright (c) 2012-2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "videoqualityjob.h" #include <QAction> #include <QFile> #include <QDomDocument> #include <QTextStream> #include <QFileInfo> #include <QUrl> #include <QDesktopServices> #include "mainwindow.h" #include "dialogs/textviewerdialog.h" #include "util.h" VideoQualityJob::VideoQualityJob(const QString &name, const QString &xml, const QString &reportPath, int frameRateNum, int frameRateDen) : MeltJob(name, xml, frameRateNum, frameRateDen) , m_reportPath(reportPath) { QAction *action = new QAction(tr("Open"), this); action->setData("Open"); action->setToolTip(tr("Open original and encoded side-by-side in the Shotcut player")); connect(action, SIGNAL(triggered()), this, SLOT(onOpenTiggered())); m_successActions << action; action = new QAction(tr("View Report"), this); connect(action, SIGNAL(triggered()), this, SLOT(onViewReportTriggered())); m_successActions << action; action = new QAction(tr("Show In Folder"), this); connect(action, SIGNAL(triggered()), this, SLOT(onShowFolderTriggered())); m_successActions << action; setLabel(tr("Measure %1").arg(objectName())); setStandardOutputFile(reportPath); } void VideoQualityJob::onOpenTiggered() { // Parse the XML. QFile file(xmlPath()); file.open(QIODevice::ReadOnly); QDomDocument dom(xmlPath()); dom.setContent(&file); file.close(); // Locate the VQM transition. QDomNodeList transitions = dom.elementsByTagName("transition"); for (int i = 0; i < transitions.length(); i++ ) { QDomElement property = transitions.at(i).firstChildElement("property"); while (!property.isNull()) { // Change the render property to 1. if (property.attribute("name") == "render") { property.firstChild().setNodeValue("1"); // Save the new XML. file.open(QIODevice::WriteOnly); QTextStream textStream(&file); dom.save(textStream, 2); file.close(); MAIN.open(xmlPath().toUtf8().constData()); break; } property = property.nextSiblingElement("property"); } } } void VideoQualityJob::onViewReportTriggered() { TextViewerDialog dialog(&MAIN); dialog.setWindowTitle(tr("Video Quality Measurement")); QFile f(m_reportPath); f.open(QIODevice::ReadOnly); QString s(f.readAll()); f.close(); dialog.setText(s); dialog.exec(); }
3,230
C++
.cpp
85
32.411765
95
0.676236
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
13,274
bitrateviewerjob.cpp
mltframework_shotcut/src/jobs/bitrateviewerjob.cpp
/* * Copyright (c) 2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "bitrateviewerjob.h" #include "dialogs/bitratedialog.h" #include "mainwindow.h" #include "util.h" #include "Logger.h" #include <QJsonObject> #include <QJsonDocument> #include <QJsonObject> #include <QString> BitrateViewerJob::BitrateViewerJob(const QString &name, const QStringList &args, double fps) : FfprobeJob(name, args) , m_resource(args.last()) , m_fps(fps) { QAction *action = new QAction(tr("Open"), this); action->setData("Open"); connect(action, &QAction::triggered, this, &BitrateViewerJob::onOpenTriggered); m_successActions << action; } BitrateViewerJob::~BitrateViewerJob() { } void BitrateViewerJob::onFinished(int exitCode, ExitStatus exitStatus) { AbstractJob::onFinished(exitCode, exitStatus); if (exitStatus == QProcess::NormalExit && exitCode == 0) { QJsonParseError error; auto s = log(); s = s.left(s.lastIndexOf('}') + 1); auto doc = QJsonDocument::fromJson(s.toUtf8(), &error); if (QJsonParseError::NoError == error.error && doc.isObject()) { auto v = doc.object().value("packets"); if (v.isArray()) { m_data = v.toArray(); onOpenTriggered(); } } else { LOG_ERROR() << "JSON parsing error:" << error.errorString(); } } } void BitrateViewerJob::onOpenTriggered() { BitrateDialog dialog(Util::baseName(m_resource), m_fps, m_data, &MAIN); dialog.exec(); }
2,240
C++
.cpp
62
30.693548
93
0.665896
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,275
exchndl.h
mltframework_shotcut/drmingw/include/exchndl.h
/* * Copyright 2002-2015 Jose Fonseca * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #pragma once #include <windows.h> // Set the unhandled exception handler. // Must be called when exchndll.dll is statically loaded (as opposed to loaded // dynamically via LoadLibrary) EXTERN_C VOID APIENTRY ExcHndlInit(void); // Override the report file name. // // Default is prog_name.RPT, in the same directory as the main executable. // // You can also pass "-" for stderr. EXTERN_C BOOL APIENTRY ExcHndlSetLogFileNameA(const char *szLogFileName);
1,209
C++
.h
31
37.225806
81
0.774359
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,284
CuteLogger_global.h
mltframework_shotcut/CuteLogger/include/CuteLogger_global.h
#ifndef CUTELOGGER_GLOBAL_H #define CUTELOGGER_GLOBAL_H #include <QtCore/qglobal.h> #if defined(CUTELOGGER_LIBRARY) # define CUTELOGGERSHARED_EXPORT Q_DECL_EXPORT #else # define CUTELOGGERSHARED_EXPORT Q_DECL_IMPORT #endif #endif // CUTELOGGER_GLOBAL_H
258
C++
.h
9
27.333333
47
0.821138
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
false
false
false
13,285
openotherdialog.h
mltframework_shotcut/src/openotherdialog.h
/* * Copyright (c) 2012-2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef OPENOTHERDIALOG_H #define OPENOTHERDIALOG_H #include <QDialog> #include <QTreeWidgetItem> namespace Ui { class OpenOtherDialog; } namespace Mlt { class Properties; class Producer; class Profile; } class QPushButton; class OpenOtherDialog : public QDialog { Q_OBJECT public: explicit OpenOtherDialog(QWidget *parent = 0); ~OpenOtherDialog(); Mlt::Producer *newProducer(Mlt::Profile &) const; void load(Mlt::Producer *); QWidget *currentWidget() const { return m_current; } private slots: void on_treeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous); private: Ui::OpenOtherDialog *ui; QWidget *m_current; QPushButton *m_addTimelineButton; Mlt::Producer *newProducer(Mlt::Profile &, QObject *widget) const; void selectTreeWidget(const QString &s); }; #endif // OPENOTHERDIALOG_H
1,586
C++
.h
51
28.352941
95
0.756066
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,286
transportcontrol.h
mltframework_shotcut/src/transportcontrol.h
/* * Copyright (c) 2012-2018 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TRANSPORTCONTROL_H #define TRANSPORTCONTROL_H #include <QObject> class TransportControllable : public QObject { Q_OBJECT public slots: virtual void play(double speed = 1.0) = 0; virtual void pause() = 0; virtual void stop() = 0; virtual void seek(int position) = 0; virtual void rewind(bool forceChangeDirection) = 0; virtual void fastForward(bool forceChangeDirection) = 0; virtual void previous(int currentPosition) = 0; virtual void next(int currentPosition) = 0; virtual void setIn(int) = 0; virtual void setOut(int) = 0; }; #endif // TRANSPORTCONTROL_H
1,312
C++
.h
35
34.685714
72
0.743126
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,287
videowidget.h
mltframework_shotcut/src/videowidget.h
/* * Copyright (c) 2011-2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef VIDEOWIDGET_H #define VIDEOWIDGET_H #include <QSemaphore> #include <QQuickWidget> #include <QMutex> #include <QThread> #include <QRectF> #include <QTimer> #include "mltcontroller.h" #include "sharedframe.h" class QmlFilter; class QmlMetadata; class QOpenGLContext; class QOffscreenSurface; namespace Mlt { class Filter; class RenderThread; class FrameRenderer; typedef void *(*thread_function_t )( void * ); class VideoWidget : public QQuickWidget, public Controller { Q_OBJECT Q_PROPERTY(QRectF rect READ rect NOTIFY rectChanged) Q_PROPERTY(int grid READ grid NOTIFY gridChanged) Q_PROPERTY(bool snapToGrid READ snapToGrid NOTIFY snapToGridChanged) Q_PROPERTY(float zoom READ zoom NOTIFY zoomChanged) Q_PROPERTY(QPoint offset READ offset NOTIFY offsetChanged) public: VideoWidget(QObject *parent = 0); virtual ~VideoWidget(); int setProducer(Mlt::Producer *, bool isMulti = false); void createThread(RenderThread **thread, thread_function_t function, void *data); void startGlsl(); void stopGlsl(); int reconfigure(bool isMulti); void play(double speed = 1.0) { Controller::play(speed); if (speed == 0) emit paused(); else emit playing(); } void seek(int position) { Controller::seek(position); emit paused(); } void refreshConsumer(bool scrubAudio = false); void pause() { Controller::pause(); emit paused(); } int displayWidth() const { return m_rect.width(); } int displayHeight() const { return m_rect.height(); } QObject *videoWidget() { return this; } QRectF rect() const { return m_rect; } int grid() const { return m_grid; } float zoom() const { return m_zoom * MLT.profile().width() / m_rect.width(); } QPoint offset() const; QImage image() const; bool imageIsProxy() const; void requestImage() const; bool snapToGrid() const { return m_snapToGrid; } int maxTextureSize() const { return m_maxTextureSize; } public slots: void setGrid(int grid); void setZoom(float zoom); void setOffsetX(int x); void setOffsetY(int y); void setBlankScene(); void setCurrentFilter(QmlFilter *filter, QmlMetadata *meta); void setSnapToGrid(bool snap); virtual void initialize(); virtual void beforeRendering() {}; virtual void renderVideo(); virtual void onFrameDisplayed(const SharedFrame &frame); signals: void frameDisplayed(const SharedFrame &frame); void dragStarted(); void seekTo(int x); void gpuNotSupported(); void started(); void paused(); void playing(); void rectChanged(); void gridChanged(); void zoomChanged(); void offsetChanged(const QPoint &offset = QPoint()); void imageReady(); void snapToGridChanged(); void toggleZoom(bool); private: QRectF m_rect; int m_grid; QPoint m_dragStart; QSemaphore m_initSem; bool m_isInitialized; std::unique_ptr<Filter> m_glslManager; std::unique_ptr<Event> m_threadStartEvent; std::unique_ptr<Event> m_threadStopEvent; std::unique_ptr<Event> m_threadCreateEvent; std::unique_ptr<Event> m_threadJoinEvent; FrameRenderer *m_frameRenderer; float m_zoom; QPoint m_offset; QUrl m_savedQmlSource; bool m_snapToGrid; QTimer m_refreshTimer; bool m_scrubAudio; QPoint m_mousePosition; std::unique_ptr<RenderThread> m_renderThread; static void on_frame_show(mlt_consumer, VideoWidget *widget, mlt_event_data); private slots: void resizeVideo(int width, int height); void onRefreshTimeout(); protected: void resizeEvent(QResizeEvent *event); void mousePressEvent(QMouseEvent *); void mouseMoveEvent(QMouseEvent *); void keyPressEvent(QKeyEvent *event); bool event(QEvent *event); void createShader(); int m_maxTextureSize; SharedFrame m_sharedFrame; QMutex m_mutex; }; class RenderThread : public QThread { Q_OBJECT public: RenderThread(thread_function_t function, void *data); ~RenderThread(); protected: void run(); private: thread_function_t m_function; void *m_data; std::unique_ptr<QOpenGLContext> m_context; std::unique_ptr<QOffscreenSurface> m_surface; }; class FrameRenderer : public QThread { Q_OBJECT public: FrameRenderer(); ~FrameRenderer(); QSemaphore *semaphore() { return &m_semaphore; } SharedFrame getDisplayFrame(); Q_INVOKABLE void showFrame(Mlt::Frame frame); void requestImage(); QImage image() const { return m_image; } signals: void frameDisplayed(const SharedFrame &frame); void imageReady(); private: QSemaphore m_semaphore; SharedFrame m_displayFrame; bool m_imageRequested; QImage m_image; }; } // namespace #endif
5,674
C++
.h
208
22.870192
85
0.699265
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,289
shotcut_mlt_properties.h
mltframework_shotcut/src/shotcut_mlt_properties.h
/* * Copyright (c) 2013-2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SHOTCUT_MLT_PROPERTIES_H #define SHOTCUT_MLT_PROPERTIES_H /* This file contains all of the Shotcut-specific MLT properties. * See also https://www.shotcut.org/notes/mltxml-annotations/ * * A property should be prefaced with an underscore if it will not be saved * in the XML even if it never has a chance of getting into there. This makes * it more clear which is also an XML annotation or purely internal use. */ /* MLT XML annotations */ #define kShotcutXmlProperty "shotcut" #define kAudioTrackProperty "shotcut:audio" #define kCommentProperty "shotcut:comment" #define kShotcutFilterProperty "shotcut:filter" #define kShotcutPlaylistProperty "shotcut:playlist" #define kShotcutTransitionProperty "shotcut:transition" #define kShotcutProducerProperty "shotcut:producer" #define kShotcutVirtualClip "shotcut:virtual" #define kTimelineScaleProperty "shotcut:scaleFactor" #define kTrackHeightProperty "shotcut:trackHeight" #define kTrackNameProperty "shotcut:name" #define kTrackLockProperty "shotcut:lock" #define kVideoTrackProperty "shotcut:video" #define kShotcutCaptionProperty "shotcut:caption" #define kShotcutDetailProperty "shotcut:detail" #define kShotcutHashProperty "shotcut:hash" #define kShotcutHiddenProperty "shotcut:hidden" #define kShotcutSkipConvertProperty "shotcut:skipConvert" #define kShotcutAnimInProperty "shotcut:animIn" #define kShotcutAnimOutProperty "shotcut:animOut" #define kShotcutMarkersProperty "shotcut:markers" #define kShotcutGroupProperty "shotcut:group" // Shotcut's VUI (video user interface) components set this so that glwidget can // hide the VUI when the play head is not over the clip with the current filter. #define kShotcutVuiMetaProperty "meta.shotcut.vui" #define kDefaultAudioIndexProperty "shotcut:defaultAudioIndex" #define kOriginalResourceProperty "shotcut:resource" #define kOriginalInProperty "shotcut:originalIn" #define kOriginalOutProperty "shotcut:originalOut" #define kDisableProxyProperty "shotcut:disableProxy" #define kBackupProperty "shotcut:backup" // "shotcut:proxy" is internal only because older versions do not know to hide it. // "shotcut:metaProxy" indicates whether the "meta." properties reflect source or proxy. #define kMetaProxyProperty "shotcut:proxy.meta" /* Project specific properties */ #define kShotcutProjectAudioChannels "shotcut:projectAudioChannels" #define kShotcutProjectFolder "shotcut:projectFolder" #define kShotcutProjectNote "shotcut:projectNote" /* Ideally all shotcut properties should begin with "shotcut:", but these * do not and kept for legacy reasons? */ #define kAspectRatioNumerator "shotcut_aspect_num" #define kAspectRatioDenominator "shotcut_aspect_den" #define kShotcutSequenceProperty "shotcut_sequence" /* Special object Ids expected by Shotcut and used in XML */ #define kBackgroundTrackId "background" #define kLegacyPlaylistTrackId "main bin" #define kPlaylistTrackId "main_bin" /* Internal only */ #define kAudioLevelsProperty "_shotcut:audio-levels" #define kBackgroundCaptureProperty "_shotcut:bgcapture" #define kPlaylistIndexProperty "_shotcut:playlistIndex" #define kPlaylistStartProperty "_shotcut:playlistStart" #define kFilterInProperty "_shotcut:filter_in" #define kFilterOutProperty "_shotcut:filter_out" #define kThumbnailInProperty "_shotcut:thumbnail-in" #define kThumbnailOutProperty "_shotcut:thumbnail-out" #define kUuidProperty "_shotcut:uuid" #define kMultitrackItemProperty "_shotcut:multitrack-item" #define kExportFromProperty "_shotcut:exportFromDefault" #define kTrackIndexProperty "_shotcut:trackIndex" #define kFilterIndexProperty "_shotcut:filterIndex" #define kNewFilterProperty "_shotcut:newFilter" #define kShotcutFiltersClipboard "shotcut:filtersClipboard" #define kIsProxyProperty "shotcut:proxy" #define kDefaultMltProfile "atsc_1080p_25" #endif // SHOTCUT_MLT_PROPERTIES_H
4,546
C++
.h
92
48.032609
88
0.827291
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,292
util.h
mltframework_shotcut/src/util.h
/* * Copyright (c) 2014-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef UTIL_H #define UTIL_H #include <QString> #include <QPalette> #include <QUrl> #include <QFileDialog> #include <MltProperties.h> class QWidget; class QDoubleSpinBox; class QTemporaryFile; namespace Mlt { class Producer; } class Util { private: Util() {} public: static QString baseName(const QString &filePath, bool trimQuery = false); static void setColorsToHighlight(QWidget *widget, QPalette::ColorRole role = QPalette::Window); static void showInFolder(const QString &path); static bool warnIfNotWritable(const QString &filePath, QWidget *parent, const QString &caption); static QString producerTitle(const Mlt::Producer &producer); static QString removeFileScheme(QUrl &url, bool fromPercentEncoding = true); static const QStringList sortedFileList(const QList<QUrl> &urls); static int coerceMultiple(int value, int multiple = 2); static QList<QUrl> expandDirectories(const QList<QUrl> &urls); static bool isDecimalPoint(QChar ch); static bool isNumeric(QString &str); static bool convertNumericString(QString &str, QChar decimalPoint); static bool convertDecimalPoints(QString &str, QChar decimalPoint); static void showFrameRateDialog(const QString &caption, int numerator, QDoubleSpinBox *spinner, QWidget *parent = Q_NULLPTR); static QTemporaryFile *writableTemporaryFile(const QString &filePath = QString(), const QString &templateName = QString()); static void applyCustomProperties(Mlt::Producer &destination, Mlt::Producer &source, int in, int out); static QString getFileHash(const QString &path); static QString getHash(Mlt::Properties &properties); static bool hasDriveLetter(const QString &path); static QFileDialog::Options getFileDialogOptions(); static bool isMemoryLow(); static QString removeQueryString(const QString &s); static int greatestCommonDivisor(int m, int n); static void normalizeFrameRate(double fps, int &numerator, int &denominator); static QString textColor(const QColor &color); static void cameraFrameRateSize(const QByteArray &deviceName, qreal &frameRate, QSize &size); static bool ProducerIsTimewarp(Mlt::Producer *producer); static QString GetFilenameFromProducer(Mlt::Producer *producer, bool useOriginal = true); static double GetSpeedFromProducer(Mlt::Producer *producer); static QString updateCaption(Mlt::Producer *producer); static void passProducerProperties(Mlt::Producer *src, Mlt::Producer *dst); static bool warnIfLowDiskSpace(const QString &path); static bool isFpsDifferent(double a, double b); static QString getNextFile(const QString &filePath); static QString trcString(int trc); static bool trcIsCompatible(int trc); static QString getConversionAdvice(Mlt::Producer *producer); static mlt_color mltColorFromQColor(const QColor &color); static void offerSingleFileConversion(QString &message, Mlt::Producer *producer, QWidget *parent); static double getAndroidFrameRate(Mlt::Producer *producer); static double getSuggestedFrameRate(Mlt::Producer *producer); }; #endif // UTIL_H
3,939
C++
.h
80
44.3375
102
0.749805
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,293
database.h
mltframework_shotcut/src/database.h
/* * Copyright (c) 2013-2021 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DATABASE_H #define DATABASE_H #include <QImage> #include <QDir> #include <QTimer> class Database : public QObject { Q_OBJECT explicit Database(QObject *parent = 0); public: static Database &singleton(QObject *parent = 0); bool putThumbnail(const QString &hash, const QImage &image); QImage getThumbnail(const QString &hash); private: QDir thumbnailsDir(); QTimer m_deleteTimer; private slots: void deleteOldThumbnails(); }; #define DB Database::singleton() #endif // DATABASE_H
1,225
C++
.h
37
30.594595
72
0.752332
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,294
mltxmlchecker.h
mltframework_shotcut/src/mltxmlchecker.h
/* * Copyright (c) 2014-2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MLTXMLCHECKER_H #define MLTXMLCHECKER_H #include <QXmlStreamReader> #include <QXmlStreamWriter> #include <QTemporaryFile> #include <QString> #include <QFileInfo> #include <QStandardItemModel> #include <QVector> #include <QPair> #include <QVersionNumber> class QUIDevice; class MltXmlChecker { public: enum { ShotcutHashRole = Qt::UserRole + 1 }; enum { MissingColumn = 0, ReplacementColumn, ColumnCount }; MltXmlChecker(); QXmlStreamReader::Error check(const QString &fileName); QString errorString() const; bool needsGPU() const { return m_needsGPU; } bool needsCPU() const { return m_needsCPU; } bool hasEffects() const { return m_hasEffects; } bool isCorrected() const { return m_isCorrected; } bool isUpdated() const { return m_isUpdated; } QTemporaryFile &tempFile() const { return *m_tempFile; } QStandardItemModel &unlinkedFilesModel() { return m_unlinkedFilesModel; } QString shotcutVersion() const { return m_shotcutVersion; } private: typedef QPair<QString, QString> MltProperty; void readMlt(); void processProperties(); void checkInAndOutPoints(); bool checkNumericString(QString &value); bool fixWebVfxPath(QString &resource); bool readResourceProperty(const QString &name, QString &value); void checkGpuEffects(const QString &mlt_service); void checkCpuEffects(const QString &mlt_service); void checkUnlinkedFile(const QString &mlt_service); bool fixUnlinkedFile(QString &value); void fixStreamIndex(MltProperty &property); bool fixVersion1701WindowsPathBug(QString &value); void checkIncludesSelf(QVector<MltProperty> &properties); void checkLumaAlphaOver(const QString &mlt_service, QVector<MltProperty> &properties); void replaceWebVfxCropFilters(QString &mlt_service, QVector<MltProperty> &properties); void replaceWebVfxChoppyFilter(QString &mlt_service, QVector<MltProperty> &properties); void checkForProxy(const QString &mlt_service, QVector<MltProperty> &properties); bool checkMltVersion(); QXmlStreamReader m_xml; QXmlStreamWriter m_newXml; bool m_needsGPU; bool m_needsCPU; bool m_hasEffects; bool m_isCorrected; bool m_isUpdated; QChar m_decimalPoint; QScopedPointer<QTemporaryFile> m_tempFile; bool m_numericValueChanged; QFileInfo m_fileInfo; QStandardItemModel m_unlinkedFilesModel; QString mlt_class; QVector<MltProperty> m_properties; struct MltXmlResource { QFileInfo info; QString hash; QString newHash; QString newDetail; QString prefix; QString suffix; int audio_index, video_index; bool isProxy; bool notProxyMeta; void clear() { info.setFile(QString()); hash.clear(); newHash.clear(); newDetail.clear(); prefix.clear(); suffix.clear(); audio_index = video_index = -1; isProxy = false; notProxyMeta = false; } } m_resource; QVersionNumber m_mltVersion; QString m_shotcutVersion; }; #endif // MLTXMLCHECKER_H
4,035
C++
.h
135
24.451852
91
0.694959
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,295
abstractproducerwidget.h
mltframework_shotcut/src/abstractproducerwidget.h
/* * Copyright (c) 2012-2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ABSTRACTPRODUCERWIDGET_H #define ABSTRACTPRODUCERWIDGET_H #include <MltProducer.h> #include <QScopedPointer> class QWidget; class AbstractProducerWidget { public: AbstractProducerWidget(); virtual ~AbstractProducerWidget(); virtual Mlt::Producer *newProducer(Mlt::Profile &) = 0; virtual void setProducer(Mlt::Producer *); virtual Mlt::Properties getPreset() const { Mlt::Properties p; return p; } virtual void loadPreset(Mlt::Properties &) {} Mlt::Producer *producer() const { return m_producer.data(); } static bool isDevice(const QWidget *widget); protected: QScopedPointer<Mlt::Producer> m_producer; }; #endif // ABSTRACTPRODUCERWIDGET_H
1,430
C++
.h
43
30
72
0.740043
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,296
autosavefile.h
mltframework_shotcut/src/autosavefile.h
/* * Copyright (c) 2011-2015 Meltytech, LLC * Author: Dan Dennedy <dan@dennedy.org> * Loosely based on ideas from KAutoSaveFile by Jacob R Rideout <kde@jacobrideout.net> * and Kdenlive by Jean-Baptiste Mardelle. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef AUTOSAVEFILE_H #define AUTOSAVEFILE_H #include <QtCore/QFile> #include <QtCore/QString> class AutoSaveFile : public QFile { Q_OBJECT public: explicit AutoSaveFile(const QString &filename, QObject *parent = 0); ~AutoSaveFile(); QString managedFileName() const { return m_managedFile; } void changeManagedFile(const QString &filename); virtual bool open(OpenMode openmode); static AutoSaveFile *getFile(const QString &filename); static QString path(); private: Q_DISABLE_COPY(AutoSaveFile) QString m_managedFile; bool m_managedFileNameChanged; }; #endif // AUTOSAVEFILE_H
1,514
C++
.h
43
32.232558
86
0.754098
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,298
player.h
mltframework_shotcut/src/player.h
/* * Copyright (c) 2012-2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef PLAYER_H #define PLAYER_H #include <QWidget> #include <QIcon> #include <QSize> #include "sharedframe.h" class DockToolBar; class ScrubBar; class QSpinBox; class QLabel; class TimeSpinBox; class QFrame; class QSlider; class QAction; class QActionGroup; class QScrollBar; class QToolButton; class QTabBar; class QHBoxLayout; class QPushButton; class TransportControllable; class QLabel; class QPushButton; class QMenu; class NewProjectFolder; class StatusLabelWidget; class Player : public QWidget { Q_OBJECT public: typedef enum { SourceTabIndex = 0, ProjectTabIndex } TabIndex; explicit Player(QWidget *parent = 0); void connectTransport(const TransportControllable *); void setIn(int); void setOut(int); void setMarkers(const QList<int> &); QSize videoSize() const; int position() const { return m_position; } NewProjectFolder *projectWidget() const { return m_projectWidget; } void moveVideoToScreen(int screen = -1); void setPauseAfterOpen(bool pause); TabIndex tabIndex() const; signals: void endOfStream(); void showStatusMessage(QString); void inChanged(int delta); void outChanged(int delta); void played(double speed); void paused(); void stopped(); void seeked(int position); void rewound(bool forceChangeDirection); void fastForwarded(bool forceChangeDirection); void previousSought(int currentPosition); void previousSought(); void nextSought(int currentPosition); void nextSought(); void zoomChanged(float zoom); void gridChanged(int grid); void scrolledHorizontally(int x); void scrolledVertically(int y); void tabIndexChanged(int index); void trimIn(); void trimOut(); void loopChanged(int start, int end); public slots: void play(double speed = 1.0); void pause(); void stop(); void seek(int position); void reset(); void onProducerOpened(bool play = true); void postProducerOpened(); void onMeltedUnitOpened(); void onDurationChanged(); void onFrameDisplayed(const SharedFrame &frame); void onVolumeChanged(int); void onCaptureStateChanged(bool); void rewind(bool forceChangeDirection = true); void fastForward(bool forceChangeDirection = true); void showPaused(); void showPlaying(); void switchToTab(TabIndex index); void enableTab(TabIndex index, bool enabled = true); void onTabBarClicked(int index); void setStatusLabel(const QString &text, int timeoutSeconds, QAction *action, QPalette::ColorRole role = QPalette::ToolTipBase); void showIdleStatus(); void focusPositionSpinner() const; void onMuteButtonToggled(bool checked); protected: void resizeEvent(QResizeEvent *event) override; bool event(QEvent *event) override; void keyPressEvent(QKeyEvent *event) override; private: void setupActions(); void adjustScrollBars(float horizontal, float vertical); double setVolume(int volume); void setLoopRange(int start, int end); void layoutToolbars(); ScrubBar *m_scrubber; TimeSpinBox *m_positionSpinner; QLabel *m_durationLabel; QLabel *m_inPointLabel; QLabel *m_selectedLabel; int m_position; int m_playPosition; QIcon m_playIcon; QIcon m_loopIcon; QIcon m_pauseIcon; QIcon m_stopIcon; QFrame *m_volumePopup; QSlider *m_volumeSlider; QPushButton *m_muteButton; int m_previousIn; int m_previousOut; double m_savedVolume; int m_duration; bool m_isSeekable; int m_isMeltedPlaying; QScrollBar *m_horizontalScroll; QScrollBar *m_verticalScroll; QToolButton *m_zoomButton; QToolButton *m_gridButton; QActionGroup *m_gridActionGroup; QAction *m_gridDefaultAction; QToolButton *m_volumeButton; float m_zoomToggleFactor; QTabBar *m_tabs; bool m_pauseAfterOpen; int m_monitorScreen; QWidget *m_videoWidget; QHBoxLayout *m_videoLayout; QWidget *m_videoScrollWidget; const TransportControllable *m_currentTransport; StatusLabelWidget *m_statusLabel; QMenu *m_zoomMenu; QMenu *m_mainMenu; NewProjectFolder *m_projectWidget; int m_loopStart; int m_loopEnd; DockToolBar *m_currentDurationToolBar; DockToolBar *m_controlsToolBar; DockToolBar *m_optionsToolBar; DockToolBar *m_inSelectedToolBar; QHBoxLayout *m_toolRow1; QHBoxLayout *m_toolRow2; private slots: void updateSelection(); void onInChanged(int in); void onOutChanged(int out); void onVolumeTriggered(); void setZoom(float factor, const QIcon &icon); void onZoomTriggered(); void toggleZoom(bool checked); void onGridToggled(); void toggleGrid(bool checked); void onStatusFinished(); void onOffsetChanged(const QPoint &offset); }; #endif // PLAYER_H
5,604
C++
.h
186
25.908602
81
0.734184
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,299
proxymanager.h
mltframework_shotcut/src/proxymanager.h
/* * Copyright (c) 2020-2021 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef PROXYMANAGER_H #define PROXYMANAGER_H #include <QDir> #include <QString> #include <QPoint> namespace Mlt { class Producer; class Service; } class ProxyManager { private: ProxyManager() {}; public: enum ScanMode { Automatic, Progressive, InterlacedTopFieldFirst, InterlacedBottomFieldFirst }; static QDir dir(); static QString resource(Mlt::Service &producer); static void generateVideoProxy(Mlt::Producer &producer, bool fullRange, ScanMode scanMode = Automatic, const QPoint &aspectRatio = QPoint(), bool replace = true); static void generateImageProxy(Mlt::Producer &producer, bool replace = true); static bool filterXML(QString &xml, QString root); static bool fileExists(Mlt::Producer &producer); static bool filePending(Mlt::Producer &producer); static bool isValidImage(Mlt::Producer &producer); static bool isValidVideo(Mlt::Producer producer); static bool generateIfNotExists(Mlt::Producer &producer, bool replace = true); static const char *videoFilenameExtension(); static const char *pendingVideoExtension(); static const char *imageFilenameExtension(); static const char *pendingImageExtension(); static int resolution(); static void generateIfNotExistsAll(Mlt::Producer &producer); static bool removePending(); static QString GoProProxyFilePath(const QString &resource); static QString DJIProxyFilePath(const QString &resource); }; #endif // PROXYMANAGER_H
2,238
C++
.h
58
34.534483
125
0.743212
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,300
defaultlayouts.h
mltframework_shotcut/src/defaultlayouts.h
#ifndef DEFAULTLAYOUTS_H #define DEFAULTLAYOUTS_H #include <QByteArray> static const auto kLayoutLoggingDefault = QByteArray::fromBase64("AAAA/wAAAAD9AAAAAwAAAAAAAAHgAAADoPwCAAAAAvsAAAAYAFAAbABhAHkAbABpAHMAdABEAG8AYwBrAQAAAFEAAAOgAAAAewD////7AAAAEgBOAG8AdABlAHMARABvAGMAawAAAAAA/////wAAAFgA////AAAAAQAAAeAAAAOg/AIAAAAE/AAAAFEAAAOgAAAAWAD////6AAAAAAIAAAAG+wAAABwAcAByAG8AcABlAHIAdABpAGUAcwBEAG8AYwBrAQAAAAD/////AAAAWAD////7AAAAFgBGAGkAbAB0AGUAcgBzAEQAbwBjAGsAAAAAAP////8AAAEsAP////sAAAAaAFMAdQBiAHQAaQB0AGwAZQBzAEQAbwBjAGsAAAAAAP////8AAABWAP////sAAAAWAGgAaQBzAHQAbwByAHkARABvAGMAawAAAAAA/////wAAAFgA////+wAAABQARQBuAGMAbwBkAGUARABvAGMAawAAAAAA/////wAAAJgA////+wAAABAASgBvAGIAcwBEAG8AYwBrAAAAAAD/////AAAAbgD////8AAACUAAAAegAAAAAAP////oAAAACAQAAAAv7AAAAHgBWAGkAZABlAG8AVgBlAGMAdABvAHIARABvAGMAawAAAAAA/////wAAAEQA////+wAAABoAVgBpAGQAZQBvAFoAbwBvAG0ARABvAGMAawAAAAAA/////wAAAEQA////+wAAABoAVgBpAGQAZQBvAFoAbwBvAG0ARABvAGMAawAAAAAA/////wAAAAAAAAAA+wAAABoAVgBpAGQAZQBvAFoAbwBvAG0ARABvAGMAawAAAAAA/////wAAAAAAAAAA+wAAAB4AUgBnAGIAVwBhAHYAZQBmAG8AcgBtAEQAbwBjAGsAAAAAAP////8AAABEAP////sAAAAaAFIAZwBiAFAAYQByAGEAZABlAEQAbwBjAGsAAAAAAP////8AAABEAP////sAAAAkAFYAaQBkAGUAbwBIAGkAcwB0AG8AZwByAGEAbQBEAG8AYwBrAAAAAAD/////AAAARAD////7AAAAIgBBAHUAZABpAG8AVwBhAHYAZQBmAG8AcgBtAEQAbwBjAGsAAAAAAP////8AAABEAP////sAAAAiAEEAdQBkAGkAbwBTAHAAZQBjAHQAcgB1AG0ARABvAGMAawAAAAAA/////wAAAEQA////+wAAACwAQQB1AGQAaQBvAEwAbwB1AGQAbgBlAHMAcwBNAGUAdABlAHIARABvAGMAawAAAAV5AAAB0gAAAEQA////+wAAACIAVgBpAGQAZQBvAFcAYQB2AGUAZgBvAHIAbQBEAG8AYwBrAAAAAAD/////AAAARAD////7AAAAIgBBAHUAZABpAG8AUwB1AHIAcgBvAHUAbgBkAEQAbwBjAGsAAAAAAP////8AAABWAP////sAAAAeAEEAdQBkAGkAbwBWAGUAYwB0AG8AcgBEAG8AYwBrAAAAAAD/////AAAAVgD///8AAAADAAADrAAAAS78AQAAAAP8AAAB6gAAA6wAAACWAP////oAAAAAAQAAAAP7AAAAFABSAGUAYwBlAG4AdABEAG8AYwBrAQAAAAD/////AAAAlgD////7AAAAGABUAGkAbQBlAGwAaQBuAGUARABvAGMAawAAAAAA/////wAAAMgA////+wAAABoASwBlAHkAZgByAGEAbQBlAHMARABvAGMAawAAAAAA/////wAAAMgA////+wAAACQAQQB1AGQAaQBvAFAAZQBhAGsATQBlAHQAZQByAEQAbwBjAGsAAAAFVwAAAEQAAABEAP////sAAAAWAE0AYQByAGsAZQByAHMARABvAGMAawAAAAMwAAAAgwAAAEQA////AAADrAAAAmgAAAABAAAAAgAAAAEAAAAC/AAAAAEAAAACAAAAAQAAABYAbQBhAGkAbgBUAG8AbwBsAEIAYQByAQAAAAD/////AAAAAAAAAAA="); static const auto kLayoutEditingDefault = QByteArray::fromBase64("AAAA/wAAAAD9AAAAAwAAAAAAAAJkAAACifwCAAAAAfwAAABRAAACiQAAAUgBAAAb+gAAAAICAAAABvsAAAAYAFAAbABhAHkAbABpAHMAdABEAG8AYwBrAQAAAAD/////AAAAewD////7AAAAFgBGAGkAbAB0AGUAcgBzAEQAbwBjAGsBAAAAAP////8AAAEsAP////sAAAAcAHAAcgBvAHAAZQByAHQAaQBlAHMARABvAGMAawEAAABGAAADGgAAAFgA////+wAAABQARQBuAGMAbwBkAGUARABvAGMAawAAAAAA/////wAAAJgA////+wAAABoAUwB1AGIAdABpAHQAbABlAHMARABvAGMAawAAAAAA/////wAAAFYA////+wAAABIATgBvAHQAZQBzAEQAbwBjAGsAAAAAAP////8AAABYAP///wAAAAEAAAFGAAACifwCAAAAA/wAAABRAAACiQAAAI4A/////AEAAAAC+wAAACQAQQB1AGQAaQBvAFAAZQBhAGsATQBlAHQAZQByAEQAbwBjAGsBAAAGOgAAAEQAAABEAP////wAAAaIAAAA+AAAAJYA////+gAAAAACAAAAA/sAAAAUAFIAZQBjAGUAbgB0AEQAbwBjAGsBAAAAAP////8AAAByAP////sAAAAWAGgAaQBzAHQAbwByAHkARABvAGMAawEAAAAA/////wAAAFgA////+wAAABAASgBvAGIAcwBEAG8AYwBrAAAAAEYAAABvAAAAbgD////7AAAAIgBBAHUAZABpAG8AUwB1AHIAcgBvAHUAbgBkAEQAbwBjAGsAAAAAAP////8AAABWAP////sAAAAeAEEAdQBkAGkAbwBWAGUAYwB0AG8AcgBEAG8AYwBrAAAAAAD/////AAAAVgD///8AAAADAAAHgAAAAQ38AQAAAAP8AAAAAAAAB4AAAADIAP////oAAAABAgAAAAL7AAAAGgBLAGUAeQBmAHIAYQBtAGUAcwBEAG8AYwBrAQAAAAD/////AAAAMwD////7AAAAGABUAGkAbQBlAGwAaQBuAGUARABvAGMAawEAAAJwAAAByAAAAMgA/////AAABf8AAAF0AAAAAAD////6AAAAAwIAAAAL+wAAAB4AVgBpAGQAZQBvAFYAZQBjAHQAbwByAEQAbwBjAGsAAAAAAP////8AAABWAP////sAAAAiAFYAaQBkAGUAbwBXAGEAdgBlAGYAbwByAG0ARABvAGMAawAAAAAA/////wAAAFYA////+wAAABoAVgBpAGQAZQBvAFoAbwBvAG0ARABvAGMAawAAAAAA/////wAAAFYA////+wAAABoAVgBpAGQAZQBvAFoAbwBvAG0ARABvAGMAawAAAAAA/////wAAAAAAAAAA+wAAABoAVgBpAGQAZQBvAFoAbwBvAG0ARABvAGMAawAAAAAA/////wAAAAAAAAAA+wAAAB4AUgBnAGIAVwBhAHYAZQBmAG8AcgBtAEQAbwBjAGsAAAAAAP////8AAABWAP////sAAAAaAFIAZwBiAFAAYQByAGEAZABlAEQAbwBjAGsAAAAAAP////8AAABWAP////sAAAAkAFYAaQBkAGUAbwBIAGkAcwB0AG8AZwByAGEAbQBEAG8AYwBrAAAAAAD/////AAAAVgD////7AAAAIgBBAHUAZABpAG8AVwBhAHYAZQBmAG8AcgBtAEQAbwBjAGsAAAAAAP////8AAABWAP////sAAAAiAEEAdQBkAGkAbwBTAHAAZQBjAHQAcgB1AG0ARABvAGMAawAAAAAA/////wAAAFYA////+wAAACwAQQB1AGQAaQBvAEwAbwB1AGQAbgBlAHMAcwBNAGUAdABlAHIARABvAGMAawAAAAJmAAAByAAAAFYA////+wAAABYATQBhAHIAawBlAHIAcwBEAG8AYwBrAAAAA/gAAAD+AAAARAD///8AAAPCAAACiQAAAAEAAAACAAAACAAAAAj8AAAAAQAAAAIAAAABAAAAFgBtAGEAaQBuAFQAbwBvAGwAQgBhAHIBAAAAAP////8AAAAAAAAAAA=="); static const auto kLayoutEffectsDefault = QByteArray::fromBase64("AAAA/wAAAAD9AAAAAwAAAAAAAANmAAACbPwCAAAAAfwAAABRAAACbAAAASwA/////AEAAAAD+wAAABYARgBpAGwAdABlAHIAcwBEAG8AYwBrAQAAAAAAAAHfAAABkAD////7AAAAGgBLAGUAeQBmAHIAYQBtAGUAcwBEAG8AYwBrAQAAAekAAAF9AAAAyAD////7AAAAEgBOAG8AdABlAHMARABvAGMAawAAAAAA/////wAAAEYA////AAAAAQAAAEQAAAJs/AIAAAAD+wAAACQAQQB1AGQAaQBvAFAAZQBhAGsATQBlAHQAZQByAEQAbwBjAGsBAAAAUQAAAmwAAABWAP////sAAAAiAEEAdQBkAGkAbwBTAHUAcgByAG8AdQBuAGQARABvAGMAawAAAAAA/////wAAAFYA////+wAAAB4AQQB1AGQAaQBvAFYAZQBjAHQAbwByAEQAbwBjAGsAAAAAAP////8AAABWAP///wAAAAMAAAeAAAABKvwBAAAABPwAAAAAAAACMgAAAEYA////+gAAAAACAAAAB/sAAAAYAFAAbABhAHkAbABpAHMAdABEAG8AYwBrAQAAAmYAAAHIAAAAewD////7AAAAGgBTAHUAYgB0AGkAdABsAGUAcwBEAG8AYwBrAAAAAAD/////AAAAVgD////7AAAAHABwAHIAbwBwAGUAcgB0AGkAZQBzAEQAbwBjAGsAAAAAAP////8AAABYAP////sAAAAUAFIAZQBjAGUAbgB0AEQAbwBjAGsAAAAAAP////8AAAByAP////sAAAAWAGgAaQBzAHQAbwByAHkARABvAGMAawAAAAAA/////wAAAFgA////+wAAABQARQBuAGMAbwBkAGUARABvAGMAawAAAAAA/////wAAAJgA////+wAAABAASgBvAGIAcwBEAG8AYwBrAAAAAAD/////AAAAbgD////7AAAAGABUAGkAbQBlAGwAaQBuAGUARABvAGMAawEAAAI8AAAFRAAAAMgA/////AAABiQAAAFPAAAAAAD////6AAAAAwIAAAAL+wAAACIAVgBpAGQAZQBvAFcAYQB2AGUAZgBvAHIAbQBEAG8AYwBrAAAAAAD/////AAAAVgD////7AAAAHgBWAGkAZABlAG8AVgBlAGMAdABvAHIARABvAGMAawAAAAAA/////wAAAFYA////+wAAABoAVgBpAGQAZQBvAFoAbwBvAG0ARABvAGMAawAAAAAA/////wAAAFYA////+wAAABoAVgBpAGQAZQBvAFoAbwBvAG0ARABvAGMAawAAAAAA/////wAAAAAAAAAA+wAAABoAVgBpAGQAZQBvAFoAbwBvAG0ARABvAGMAawAAAAAA/////wAAAAAAAAAA+wAAAB4AUgBnAGIAVwBhAHYAZQBmAG8AcgBtAEQAbwBjAGsAAAAAAP////8AAABWAP////sAAAAaAFIAZwBiAFAAYQByAGEAZABlAEQAbwBjAGsAAAAAAP////8AAABWAP////sAAAAkAFYAaQBkAGUAbwBIAGkAcwB0AG8AZwByAGEAbQBEAG8AYwBrAAAAAAD/////AAAAVgD////7AAAAIgBBAHUAZABpAG8AVwBhAHYAZQBmAG8AcgBtAEQAbwBjAGsAAAAAAP////8AAABWAP////sAAAAiAEEAdQBkAGkAbwBTAHAAZQBjAHQAcgB1AG0ARABvAGMAawAAAAAA/////wAAAFYA////+wAAACwAQQB1AGQAaQBvAEwAbwB1AGQAbgBlAHMAcwBNAGUAdABlAHIARABvAGMAawAAAAJmAAAByAAAAFYA////+wAAABYATQBhAHIAawBlAHIAcwBEAG8AYwBrAAAAA+oAAAEMAAAARAD///8AAAPCAAACbAAAAAEAAAACAAAACAAAAAj8AAAAAQAAAAIAAAABAAAAFgBtAGEAaQBuAFQAbwBvAGwAQgBhAHIBAAAAAP////8AAAAAAAAAAA=="); static const auto kLayoutColorDefault = QByteArray::fromBase64("AAAA/wAAAAD9AAAAAwAAAAAAAAJMAAACbPwCAAAAAfwAAABRAAACbAAAASwA////+gAAAAEBAAAABPsAAAAUAEUAbgBjAG8AZABlAEQAbwBjAGsAAAAAAP////8AAAFWAP////sAAAAWAEYAaQBsAHQAZQByAHMARABvAGMAawEAAAAAAAADEAAAAZAA////+wAAABoAUwB1AGIAdABpAHQAbABlAHMARABvAGMAawAAAAAA/////wAAAEQA////+wAAABIATgBvAHQAZQBzAEQAbwBjAGsAAAAAAP////8AAABGAP///wAAAAEAAAFeAAADoPwCAAAAA/wAAABRAAABDAAAAHIA/////AEAAAAC+wAAACQAQQB1AGQAaQBvAFAAZQBhAGsATQBlAHQAZQByAEQAbwBjAGsAAAAF+QAAAEQAAABEAP////wAAAYiAAABXgAAAHsA////+gAAAAACAAAAAvsAAAAeAFYAaQBkAGUAbwBWAGUAYwB0AG8AcgBEAG8AYwBrAQAAAHYAAADiAAAAVgD////7AAAAGgBWAGkAZABlAG8AWgBvAG8AbQBEAG8AYwBrAQAAAAD/////AAAAVgD////8AAABZwAAAVgAAAByAQAAG/oAAAAAAQAAAAb7AAAAGgBSAGcAYgBQAGEAcgBhAGQAZQBEAG8AYwBrAQAAAAD/////AAAARAD////7AAAAGgBWAGkAZABlAG8AWgBvAG8AbQBEAG8AYwBrAQAABfAAAAF6AAAAAAAAAAD7AAAAHgBSAGcAYgBXAGEAdgBlAGYAbwByAG0ARABvAGMAawEAAAAA/////wAAAEQA////+wAAACIAVgBpAGQAZQBvAFcAYQB2AGUAZgBvAHIAbQBEAG8AYwBrAQAAAAD/////AAAARAD////7AAAAIgBBAHUAZABpAG8AUwB1AHIAcgBvAHUAbgBkAEQAbwBjAGsAAAAAAP////8AAABEAP////sAAAAeAEEAdQBkAGkAbwBWAGUAYwB0AG8AcgBEAG8AYwBrAAAAAAD/////AAAARAD////8AAACyQAAASgAAABWAP////oAAAAAAQAAAAL7AAAAJABWAGkAZABlAG8ASABpAHMAdABvAGcAcgBhAG0ARABvAGMAawEAAAAA/////wAAAEQA////+wAAABoAVgBpAGQAZQBvAFoAbwBvAG0ARABvAGMAawEAAAXwAAABegAAAAAAAAAAAAAAAwAABhgAAAEq/AEAAAAE/AAAAAAAAAFWAAAAAAD////6/////wIAAAAF+wAAABgAUABsAGEAeQBsAGkAcwB0AEQAbwBjAGsAAAAAAP////8AAAB7AP////sAAAAUAFIAZQBjAGUAbgB0AEQAbwBjAGsAAAAAAP////8AAAByAP////sAAAAcAHAAcgBvAHAAZQByAHQAaQBlAHMARABvAGMAawAAAAAA/////wAAAFgA////+wAAABYAaABpAHMAdABvAHIAeQBEAG8AYwBrAAAAAAD/////AAAAWAD////7AAAAEABKAG8AYgBzAEQAbwBjAGsAAAAAAP////8AAABuAP////wAAAAAAAAGGAAAAMgA////+gAAAAACAAAAAvsAAAAYAFQAaQBtAGUAbABpAG4AZQBEAG8AYwBrAQAAAioAAAIEAAAAyAD////7AAAAGgBLAGUAeQBmAHIAYQBtAGUAcwBEAG8AYwBrAAAAAAD/////AAAAMwD////8AAAE6QAAAQEAAAAAAP////r/////AgAAAAP7AAAAIgBBAHUAZABpAG8AVwBhAHYAZQBmAG8AcgBtAEQAbwBjAGsAAAAAAP////8AAABWAP////sAAAAiAEEAdQBkAGkAbwBTAHAAZQBjAHQAcgB1AG0ARABvAGMAawAAAAAA/////wAAAFYA////+wAAACwAQQB1AGQAaQBvAEwAbwB1AGQAbgBlAHMAcwBNAGUAdABlAHIARABvAGMAawAAAAJmAAAByAAAAFYA////+wAAABYATQBhAHIAawBlAHIAcwBEAG8AYwBrAAAAAt8AAACzAAAARAD///8AAAPCAAACbAAAAAEAAAACAAAACAAAAAL8AAAAAQAAAAIAAAABAAAAFgBtAGEAaQBuAFQAbwBvAGwAQgBhAHIBAAAAAP////8AAAAAAAAAAA=="); static const auto kLayoutAudioDefault = QByteArray::fromBase64("AAAA/wAAAAD9AAAAAwAAAAAAAAJsAAACbPwCAAAAAfwAAABRAAACbAAAASwA////+gAAAAEBAAAABPsAAAAUAEUAbgBjAG8AZABlAEQAbwBjAGsAAAAAAP////8AAAFWAP////sAAAAWAEYAaQBsAHQAZQByAHMARABvAGMAawEAAAAAAAADEAAAAZAA////+wAAABoAUwB1AGIAdABpAHQAbABlAHMARABvAGMAawAAAAAA/////wAAAEQA////+wAAABIATgBvAHQAZQBzAEQAbwBjAGsAAAAAAP////8AAABGAP///wAAAAEAAAE+AAADoPwCAAAAA/wAAABRAAABoQAAAFYA/////AEAAAAC+wAAACQAQQB1AGQAaQBvAFAAZQBhAGsATQBlAHQAZQByAEQAbwBjAGsBAAAGQgAAAFcAAABEAP////wAAAajAAAA3QAAAEQA////+gAAAAACAAAAA/sAAAAsAEEAdQBkAGkAbwBMAG8AdQBkAG4AZQBzAHMATQBlAHQAZQByAEQAbwBjAGsBAAAAAP////8AAABWAP////sAAAAaAFYAaQBkAGUAbwBaAG8AbwBtAEQAbwBjAGsAAAAARgAAAP4AAABWAP////sAAAAeAFYAaQBkAGUAbwBWAGUAYwB0AG8AcgBEAG8AYwBrAAAAAAD/////AAAAVgD////8AAAB/AAAANEAAABWAP////oAAAAAAQAAAAf7AAAAIgBBAHUAZABpAG8AUwBwAGUAYwB0AHIAdQBtAEQAbwBjAGsBAAAAAP////8AAABEAP////sAAAAaAFIAZwBiAFAAYQByAGEAZABlAEQAbwBjAGsAAAAAAP////8AAABEAP////sAAAAaAFYAaQBkAGUAbwBaAG8AbwBtAEQAbwBjAGsAAAAF8AAAAXoAAAAAAAAAAPsAAAAeAFIAZwBiAFcAYQB2AGUAZgBvAHIAbQBEAG8AYwBrAAAAAAD/////AAAARAD////7AAAAIgBWAGkAZABlAG8AVwBhAHYAZQBmAG8AcgBtAEQAbwBjAGsAAAAAAP////8AAABEAP////sAAAAiAEEAdQBkAGkAbwBTAHUAcgByAG8AdQBuAGQARABvAGMAawAAAAAA/////wAAAEQA////+wAAAB4AQQB1AGQAaQBvAFYAZQBjAHQAbwByAEQAbwBjAGsAAAAAAP////8AAABEAP////wAAALXAAABGgAAAFYA////+gAAAAABAAAAA/sAAAAiAEEAdQBkAGkAbwBXAGEAdgBlAGYAbwByAG0ARABvAGMAawEAAAAA/////wAAAEQA////+wAAACQAVgBpAGQAZQBvAEgAaQBzAHQAbwBnAHIAYQBtAEQAbwBjAGsAAAAAAP////8AAABEAP////sAAAAaAFYAaQBkAGUAbwBaAG8AbwBtAEQAbwBjAGsAAAAF8AAAAXoAAAAAAAAAAAAAAAMAAAY4AAABKvwBAAAAA/wAAAAAAAABVgAAAAAA////+v////8CAAAABfsAAAAYAFAAbABhAHkAbABpAHMAdABEAG8AYwBrAAAAAAD/////AAAAewD////7AAAAFABSAGUAYwBlAG4AdABEAG8AYwBrAAAAAAD/////AAAAcgD////7AAAAHABwAHIAbwBwAGUAcgB0AGkAZQBzAEQAbwBjAGsAAAAAAP////8AAABYAP////sAAAAWAGgAaQBzAHQAbwByAHkARABvAGMAawAAAAAA/////wAAAFgA////+wAAABAASgBvAGIAcwBEAG8AYwBrAAAAAAD/////AAAAbgD////8AAAAAAAABjgAAADIAP////oAAAAAAgAAAAL7AAAAGABUAGkAbQBlAGwAaQBuAGUARABvAGMAawEAAAIqAAACBAAAAMgA////+wAAABoASwBlAHkAZgByAGEAbQBlAHMARABvAGMAawEAAAAA/////wAAADMA////+wAAABYATQBhAHIAawBlAHIAcwBEAG8AYwBrAAAAAtQAAADeAAAARAD///8AAAPCAAACbAAAAAEAAAACAAAACAAAAAL8AAAAAQAAAAIAAAABAAAAFgBtAGEAaQBuAFQAbwBvAGwAQgBhAHIBAAAAAP////8AAAAAAAAAAA=="); static const auto kLayoutPlayerDefault = QByteArray::fromBase64("AAAA/wAAAAD9AAAAAwAAAAAAAAJFAAADoPwCAAAAAfwAAABRAAADoAAAAAAA/////AEAAAAD+wAAABgAUABsAGEAeQBsAGkAcwB0AEQAbwBjAGsAAAAAAAAAAyIAAABGAP////wAAAAAAAACRQAAAAAA////+v////8CAAAABPsAAAAcAHAAcgBvAHAAZQByAHQAaQBlAHMARABvAGMAawAAAABGAAADGgAAAFgA////+wAAABoAUwB1AGIAdABpAHQAbABlAHMARABvAGMAawAAAAAA/////wAAAFYA////+wAAABYARgBpAGwAdABlAHIAcwBEAG8AYwBrAAAAAAD/////AAABLAD////7AAAAFABFAG4AYwBvAGQAZQBEAG8AYwBrAAAAAAD/////AAAAmAD////7AAAAEgBOAG8AdABlAHMARABvAGMAawAAAAAA/////wAAAEYA////AAAAAQAAAYsAAAI3/AIAAAAD/AAAADMAAAI3AAAAAAD////8AQAAAAL7AAAAJABBAHUAZABpAG8AUABlAGEAawBNAGUAdABlAHIARABvAGMAawAAAAXfAAABiwAAAEQA/////AAABegAAAGLAAAAAAD////6/////wIAAAAD+wAAABQAUgBlAGMAZQBuAHQARABvAGMAawAAAAAA/////wAAAHIA////+wAAABYAaABpAHMAdABvAHIAeQBEAG8AYwBrAAAAAAD/////AAAAWAD////7AAAAEABKAG8AYgBzAEQAbwBjAGsAAAAARgAAAG8AAABuAP////sAAAAiAEEAdQBkAGkAbwBTAHUAcgByAG8AdQBuAGQARABvAGMAawAAAAAA/////wAAAFYA////+wAAAB4AQQB1AGQAaQBvAFYAZQBjAHQAbwByAEQAbwBjAGsAAAAAAP////8AAABWAP///wAAAAMAAAT2AAABL/wBAAAAA/wAAAAAAAAD5QAAAAAA////+v////8CAAAAAvsAAAAYAFQAaQBtAGUAbABpAG4AZQBEAG8AYwBrAAAAAAD/////AAAAyAD////7AAAAGgBLAGUAeQBmAHIAYQBtAGUAcwBEAG8AYwBrAAAAA2YAAADIAAAAMwD////8AAAAAAAAB3MAAAAAAP////oAAAADAgAAAAv7AAAAIgBWAGkAZABlAG8AVwBhAHYAZQBmAG8AcgBtAEQAbwBjAGsAAAAAAP////8AAABWAP////sAAAAeAFYAaQBkAGUAbwBWAGUAYwB0AG8AcgBEAG8AYwBrAAAAAAD/////AAAAVgD////7AAAAGgBWAGkAZABlAG8AWgBvAG8AbQBEAG8AYwBrAAAAAAD/////AAAAVgD////7AAAAGgBWAGkAZABlAG8AWgBvAG8AbQBEAG8AYwBrAAAAAAD/////AAAAAAAAAAD7AAAAGgBWAGkAZABlAG8AWgBvAG8AbQBEAG8AYwBrAAAAAAD/////AAAAAAAAAAD7AAAAHgBSAGcAYgBXAGEAdgBlAGYAbwByAG0ARABvAGMAawAAAAAA/////wAAAFYA////+wAAABoAUgBnAGIAUABhAHIAYQBkAGUARABvAGMAawAAAAAA/////wAAAFYA////+wAAACQAVgBpAGQAZQBvAEgAaQBzAHQAbwBnAHIAYQBtAEQAbwBjAGsAAAAAAP////8AAABWAP////sAAAAiAEEAdQBkAGkAbwBXAGEAdgBlAGYAbwByAG0ARABvAGMAawAAAAAA/////wAAAFYA////+wAAACIAQQB1AGQAaQBvAFMAcABlAGMAdAByAHUAbQBEAG8AYwBrAAAAAAD/////AAAAVgD////7AAAALABBAHUAZABpAG8ATABvAHUAZABuAGUAcwBzAE0AZQB0AGUAcgBEAG8AYwBrAAAAAmYAAAHIAAAAVgD////7AAAAFgBNAGEAcgBrAGUAcgBzAEQAbwBjAGsAAAAAAAAABPYAAABEAP///wAAB4AAAAOgAAAAAQAAAAIAAAAIAAAACPwAAAABAAAAAgAAAAEAAAAWAG0AYQBpAG4AVABvAG8AbABCAGEAcgEAAAAA/////wAAAAAAAAAA"); #endif // DEFAULTLAYOUTS_H
13,142
C++
.h
16
818.375
2,227
0.884357
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,301
settings.h
mltframework_shotcut/src/settings.h
/* * Copyright (c) 2013-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SETTINGS_H #define SETTINGS_H #include <framework/mlt_types.h> #include <QKeySequence> #include <QObject> #include <QSettings> #include <QStringList> #include <QByteArray> #include <QThread> class ShotcutSettings : public QObject { Q_OBJECT Q_PROPERTY(bool timelineDragScrub READ timelineDragScrub WRITE setTimelineDragScrub NOTIFY timelineDragScrubChanged) Q_PROPERTY(bool timelineShowWaveforms READ timelineShowWaveforms WRITE setTimelineShowWaveforms NOTIFY timelineShowWaveformsChanged) Q_PROPERTY(bool timelineShowThumbnails READ timelineShowThumbnails WRITE setTimelineShowThumbnails NOTIFY timelineShowThumbnailsChanged) Q_PROPERTY(bool timelineRipple READ timelineRipple WRITE setTimelineRipple NOTIFY timelineRippleChanged) Q_PROPERTY(bool timelineRippleAllTracks READ timelineRippleAllTracks WRITE setTimelineRippleAllTracks NOTIFY timelineRippleAllTracksChanged) Q_PROPERTY(bool timelineRippleMarkers READ timelineRippleMarkers WRITE setTimelineRippleMarkers NOTIFY timelineRippleMarkersChanged) Q_PROPERTY(bool timelineSnap READ timelineSnap WRITE setTimelineSnap NOTIFY timelineSnapChanged) Q_PROPERTY(bool timelineScrollZoom READ timelineScrollZoom WRITE setTimelineScrollZoom NOTIFY timelineScrollZoomChanged) Q_PROPERTY(bool timelineFramebufferWaveform READ timelineFramebufferWaveform WRITE setTimelineFramebufferWaveform NOTIFY timelineFramebufferWaveformChanged) Q_PROPERTY(QString openPath READ openPath WRITE setOpenPath NOTIFY openPathChanged) Q_PROPERTY(QString savePath READ savePath WRITE setSavePath NOTIFY savePathChanged) Q_PROPERTY(QString playlistThumbnails READ playlistThumbnails WRITE setPlaylistThumbnails NOTIFY playlistThumbnailsChanged) Q_PROPERTY(QString viewMode READ viewMode WRITE setViewMode NOTIFY viewModeChanged) Q_PROPERTY(int playerAudioChannels READ playerAudioChannels NOTIFY playerAudioChannelsChanged) Q_PROPERTY(bool playerGPU READ playerGPU NOTIFY playerGpuChanged) Q_PROPERTY(double audioInDuration READ audioInDuration WRITE setAudioInDuration NOTIFY audioInDurationChanged) Q_PROPERTY(double audioOutDuration READ audioOutDuration WRITE setAudioOutDuration NOTIFY audioOutDurationChanged) Q_PROPERTY(double videoInDuration READ videoInDuration WRITE setVideoInDuration NOTIFY videoInDurationChanged) Q_PROPERTY(double videoOutDuration READ videoOutDuration WRITE setVideoOutDuration NOTIFY videoOutDurationChanged) Q_PROPERTY(bool smallIcons READ smallIcons WRITE setSmallIcons NOTIFY smallIconsChanged) Q_PROPERTY(bool askOutputFilter READ askOutputFilter WRITE setAskOutputFilter NOTIFY askOutputFilterChanged) Q_PROPERTY(QString appDataLocation READ appDataLocation CONSTANT) Q_PROPERTY(TimelineScrolling timelineScrolling READ timelineScrolling WRITE setTimelineScrolling NOTIFY timelineScrollingChanged) Q_ENUMS(TimelineScrolling) Q_PROPERTY(bool timelineRectangleSelect READ timelineRectangleSelect WRITE setTimelineRectangleSelect NOTIFY timelineRectangleSelectChanged) Q_PROPERTY(bool keyframesDragScrub READ keyframesDragScrub WRITE setKeyframesDragScrub NOTIFY keyframesDragScrubChanged) public: static const qsizetype MaxPath {32767}; enum TimelineScrolling { NoScrolling, CenterPlayhead, PageScrolling, SmoothScrolling }; static ShotcutSettings &singleton(); void log(); // general QString language() const; void setLanguage(const QString &); double imageDuration() const; void setImageDuration(double); QString openPath() const; void setOpenPath(const QString &); QString savePath() const; void setSavePath(const QString &); QStringList recent() const; void setRecent(const QStringList &); QStringList projects(); void setProjects(const QStringList &); QString theme() const; void setTheme(const QString &); QThread::Priority jobPriority() const; void setJobPriority(const QString &); bool showTitleBars() const; void setShowTitleBars(bool); bool showToolBar() const; void setShowToolBar(bool); bool textUnderIcons() const; void setTextUnderIcons(bool); bool smallIcons() const; void setSmallIcons(bool); QByteArray windowGeometry() const; void setWindowGeometry(const QByteArray &); QByteArray windowGeometryDefault() const; void setWindowGeometryDefault(const QByteArray &); QByteArray windowState() const; void setWindowState(const QByteArray &); QByteArray windowStateDefault() const; void setWindowStateDefault(const QByteArray &); QString viewMode() const; void setViewMode(const QString &viewMode); QString exportFrameSuffix() const; void setExportFrameSuffix(const QString &suffix); bool convertAdvanced() const; void setConvertAdvanced(bool); // encode QString encodePath() const; void setEncodePath(const QString &); bool encodeFreeSpaceCheck() const; void setEncodeFreeSpaceCheck(bool); bool encodeUseHardware() const; void setEncodeUseHardware(bool); QStringList encodeHardware() const; void setEncodeHardware(const QStringList &); bool encodeAdvanced() const; void setEncodeAdvanced(bool); bool showConvertClipDialog() const; void setShowConvertClipDialog(bool); bool encodeParallelProcessing() const; void setEncodeParallelProcessing(bool); // player int playerAudioChannels() const; void setPlayerAudioChannels(int); QString playerDeinterlacer() const; void setPlayerDeinterlacer(const QString &); QString playerExternal() const; void setPlayerExternal(const QString &); bool playerGPU() const; void setPlayerGPU(bool); bool playerWarnGPU() const; QString playerInterpolation() const; void setPlayerInterpolation(const QString &); bool playerJACK() const; void setPlayerJACK(bool); int playerKeyerMode() const; void setPlayerKeyerMode(int); bool playerMuted() const; void setPlayerMuted(bool); QString playerProfile() const; void setPlayerProfile(const QString &); bool playerProgressive() const; void setPlayerProgressive(bool); bool playerRealtime() const; void setPlayerRealtime(bool); bool playerScrubAudio() const; void setPlayerScrubAudio(bool); int playerVolume() const; void setPlayerVolume(int); float playerZoom() const; void setPlayerZoom(float); int playerPreviewScale() const; void setPlayerPreviewScale(int); int playerVideoDelayMs() const; void setPlayerVideoDelayMs(int); double playerJumpSeconds() const; void setPlayerJumpSeconds(double); QString playerAudioDriver() const; void setPlayerAudioDriver(const QString &s); // playlist QString playlistThumbnails() const; void setPlaylistThumbnails(const QString &); bool playlistAutoplay() const; void setPlaylistAutoplay(bool); bool playlistShowColumn(const QString &); void setPlaylistShowColumn(const QString &, bool); // timeline bool timelineDragScrub() const; void setTimelineDragScrub(bool); bool timelineShowWaveforms() const; void setTimelineShowWaveforms(bool); bool timelineShowThumbnails() const; void setTimelineShowThumbnails(bool); bool timelineRipple() const; void setTimelineRipple(bool); bool timelineRippleAllTracks() const; void setTimelineRippleAllTracks(bool); bool timelineRippleMarkers() const; void setTimelineRippleMarkers(bool); bool timelineSnap() const; void setTimelineSnap(bool); int timelineTrackHeight() const; void setTimelineTrackHeight(int); bool timelineScrollZoom() const; void setTimelineScrollZoom(bool); bool timelineFramebufferWaveform() const; void setTimelineFramebufferWaveform(bool); int audioReferenceTrack() const; void setAudioReferenceTrack(int); double audioReferenceSpeedRange() const; void setAudioReferenceSpeedRange(double); bool timelinePreviewTransition() const; void setTimelinePreviewTransition(bool); void setTimelineScrolling(TimelineScrolling value); TimelineScrolling timelineScrolling() const; bool timelineAutoAddTracks() const; void setTimelineAutoAddTracks(bool); bool timelineRectangleSelect() const; void setTimelineRectangleSelect(bool); // filter QString filterFavorite(const QString &filterName); void setFilterFavorite(const QString &filterName, const QString &value); double audioInDuration() const; void setAudioInDuration(double); double audioOutDuration() const; void setAudioOutDuration(double); double videoInDuration() const; void setVideoInDuration(double); double videoOutDuration() const; void setVideoOutDuration(double); bool askOutputFilter() const; void setAskOutputFilter(bool); // scope bool loudnessScopeShowMeter(const QString &meter) const; void setLoudnessScopeShowMeter(const QString &meter, bool b); // Markers void setMarkerColor(const QColor &color); QColor markerColor() const; void setMarkersShowColumn(const QString &column, bool b); bool markersShowColumn(const QString &column) const; void setMarkerSort(int column, Qt::SortOrder order); int getMarkerSortColumn(); Qt::SortOrder getMarkerSortOrder(); // general continued int drawMethod() const; void setDrawMethod(int); bool noUpgrade() const; void setNoUpgrade(bool value); bool checkUpgradeAutomatic(); void setCheckUpgradeAutomatic(bool b); bool askUpgradeAutomatic(); void setAskUpgradeAutomatic(bool b); bool askChangeVideoMode(); void setAskChangeVideoMode(bool b); void sync(); QString appDataLocation() const; static void setAppDataForSession(const QString &location); void setAppDataLocally(const QString &location); // layout QStringList layouts() const; bool setLayout(const QString &name, const QByteArray &geometry, const QByteArray &state); QByteArray layoutGeometry(const QString &name); QByteArray layoutState(const QString &name); bool removeLayout(const QString &name); int layoutMode() const; void setLayoutMode(int mode = 0); // general continued bool clearRecent() const; void setClearRecent(bool); QString projectsFolder() const; void setProjectsFolder(const QString &path); QString audioInput() const; void setAudioInput(const QString &name); QString videoInput() const; void setVideoInput(const QString &name); QString glaxnimatePath() const; void setGlaxnimatePath(const QString &path); bool exportRangeMarkers() const; void setExportRangeMarkers(bool); int undoLimit() const; bool warnLowMemory() const; int backupPeriod() const; void setBackupPeriod(int i); mlt_time_format timeFormat() const; void setTimeFormat(int format); // proxy bool proxyEnabled() const; void setProxyEnabled(bool); QString proxyFolder() const; void setProxyFolder(const QString &path); bool proxyUseProjectFolder() const; void setProxyUseProjectFolder(bool); bool proxyUseHardware() const; void setProxyUseHardware(bool); // Shortcuts void clearShortcuts(const QString &name); void setShortcuts(const QString &name, const QList<QKeySequence> &shortcuts); QList<QKeySequence> shortcuts(const QString &name); // Slideshow double slideshowClipDuration(double defaultClipDuration) const; void setSlideshowClipDuration(double clipDuration); int slideshowAspectConversion(int defaultAspectConversion) const; void setSlideshowAspectConversion(int aspectConversion); int slideshowZoomPercent(int defaultZoomPercent) const; void setSlideshowZoomPercent(int zoomPercent); double slideshowTransitionDuration(double defaultTransitionDuration) const; void setSlideshowTransitionDuration(double transitionDuration); int slideshowTransitionStyle(int defaultTransitionStyle) const; void setSlideshowTransitionStyle(int transitionStyle); int slideshowTransitionSoftness(int defaultTransitionSoftness) const; void setSlideshowTransitionSoftness(int transitionSoftness); // Keyframes bool keyframesDragScrub() const; void setKeyframesDragScrub(bool); // Subtitles void setSubtitlesShowColumn(const QString &column, bool b); bool subtitlesShowColumn(const QString &column) const; void setSubtitlesTrackTimeline(bool b); bool subtitlesTrackTimeline() const; void setSubtitlesShowPrevNext(bool b); bool subtitlesShowPrevNext() const; void setWhisperExe(const QString &path); QString whisperExe(); void setWhisperModel(const QString &path); QString whisperModel(); // Notes void setNotesZoom(int zoom); int notesZoom() const; public slots: void reset(); signals: void openPathChanged(); void savePathChanged(); void timelineDragScrubChanged(); void timelineShowWaveformsChanged(); void timelineShowThumbnailsChanged(); void timelineRippleChanged(); void timelineRippleAllTracksChanged(); void timelineRippleMarkersChanged(); void timelineSnapChanged(); void timelineScrollZoomChanged(); void timelineFramebufferWaveformChanged(); void playerAudioChannelsChanged(int); void playerGpuChanged(); void audioInDurationChanged(); void audioOutDurationChanged(); void videoInDurationChanged(); void videoOutDurationChanged(); void playlistThumbnailsChanged(); void viewModeChanged(); void smallIconsChanged(); void askOutputFilterChanged(); void timelineScrollingChanged(); void timelineAutoAddTracksChanged(); void timelineRectangleSelectChanged(); void timeFormatChanged(); void keyframesDragScrubChanged(); private: explicit ShotcutSettings(); explicit ShotcutSettings(const QString &appDataLocation); void migrateRecent(); void migrateLayout(); QSettings settings; QString m_appDataLocation; QSettings m_recent; }; #define Settings ShotcutSettings::singleton() #endif // SETTINGS_H
15,110
C++
.h
362
36.430939
102
0.768922
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,302
windowstools.h
mltframework_shotcut/src/windowstools.h
/* * Copyright (c) 2012-2020 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <QWinTaskbarButton> #include <QWinTaskbarProgress> #include <QWidget> class WindowsTaskbarButton { public: static WindowsTaskbarButton &getInstance(); void setParentWindow(QWidget *parent); void setProgress(int progress); void resetProgress(); private: WindowsTaskbarButton(); QWinTaskbarButton *m_taskbarButton; QWinTaskbarProgress *m_taskbarProgress; };
1,095
C++
.h
31
32.806452
72
0.769811
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,303
mltcontroller.h
mltframework_shotcut/src/mltcontroller.h
/* * Copyright (c) 2011-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MLTCONTROLLER_H #define MLTCONTROLLER_H #include <QImage> #include <QString> #include <QUuid> #include <QScopedPointer> #include <QTemporaryFile> #include <QMutex> #include <Mlt.h> #include "transportcontrol.h" // forward declarations class QQuickView; #define MLT_LC_CATEGORY LC_ALL #define MLT_LC_NAME "LC_ALL" #if LIBMLT_VERSION_INT >= ((7<<16)+(19<<8)) #define kAudioIndexProperty "astream" #define kVideoIndexProperty "vstream" #else #define kAudioIndexProperty "audio_index" #define kVideoIndexProperty "video_index" #endif namespace Mlt { const int kMaxImageDurationSecs = 3600 * 4; extern const QString XmlMimeType; class TransportControl : public TransportControllable { Q_OBJECT public slots: void play(double speed = 1.0) override; void pause() override; void stop() override; void seek(int position) override; void rewind(bool forceChangeDirection) override; void fastForward(bool forceChangeDirection) override; void previous(int currentPosition) override; void next(int currentPosition) override; void setIn(int) override; void setOut(int) override; }; class Controller { protected: Controller(); virtual int reconfigure(bool isMulti) = 0; public: static Controller &singleton(QObject *parent = nullptr); virtual ~Controller(); static void destroy(); virtual QObject *videoWidget() = 0; virtual int setProducer(Mlt::Producer *, bool isMulti = false); virtual int open(const QString &url, const QString &urlToSave, bool skipConvert = false); bool openXML(const QString &filename); virtual void close(); virtual int displayWidth() const = 0; virtual int displayHeight() const = 0; void closeConsumer(); virtual void play(double speed = 1.0); bool isPaused() const; virtual void pause(); void stop(); bool enableJack(bool enable = true); void setVolume(double volume, bool muteOnPause = true); double volume() const; void onWindowResize(); virtual void seek(int position); virtual void refreshConsumer(bool scrubAudio = false); bool saveXML(const QString &filename, Service *service = nullptr, bool withRelativePaths = true, QTemporaryFile *tempFile = nullptr, bool proxy = false, QString projectNote = QString()); QString XML(Service *service = nullptr, bool withProfile = false, bool withMetadata = true); int consumerChanged(); void setProfile(const QString &profile_name); void setAudioChannels(int audioChannels); QString resource() const; bool isSeekable(Mlt::Producer *p = nullptr) const; bool isLiveProducer(Mlt::Producer *p = nullptr) const; bool isClip() const; bool isSeekableClip(); bool isPlaylist() const; bool isMultitrack() const; bool isImageProducer(Service *service) const; bool isFileProducer(Service *service) const; void rewind(bool forceChangeDirection); void fastForward(bool forceChangeDirection); void previous(int currentPosition); void next(int currentPosition); void setIn(int); void setOut(int); void fixLengthProperties(Service &service); void restart(const QString &xml = ""); void resetURL(); QImage image(Frame *frame, int width, int height); QImage image(Mlt::Producer &producer, int frameNumber, int width, int height); void updateAvformatCaching(int trackCount); bool isAudioFilter(const QString &name); int realTime() const; void setImageDurationFromDefault(Service *service) const; void setDurationFromDefault(Producer *service) const; void lockCreationTime(Producer *producer) const; Producer *setupNewProducer(Producer *newProducer) const; QUuid uuid(Mlt::Properties &properties) const; void setUuid(Mlt::Properties &properties, QUuid uid) const; QUuid ensureHasUuid(Mlt::Properties &properties) const; static void copyFilters(Mlt::Producer &fromProducer, Mlt::Producer &toProducer, bool fromClipboard = false, bool includeDisabled = true); void copyFilters(Mlt::Producer *producer = nullptr); void pasteFilters(Mlt::Producer *producer = nullptr, Mlt::Producer *fromProducer = nullptr); static void adjustFilters(Mlt::Producer &producer, int startIndex = 0); static void adjustFilter(Mlt::Filter *filter, int in, int out, int inDelta, int outDelta, int keyframeDelta); static void adjustClipFilters(Mlt::Producer &producer, int in, int out, int inDelta, int outDelta, int keyframeDelta); bool hasFiltersOnClipboard() const { return m_filtersClipboard->is_valid() && m_filtersClipboard->filter_count() > 0; } QString filtersClipboardXML() { return XML(m_filtersClipboard.get()); } int audioChannels() const { return m_audioChannels; } Mlt::Repository *repository() const { return m_repo; } Mlt::Profile &profile() { return m_profile; } Mlt::Profile &previewProfile() { return m_previewProfile; } Mlt::Producer *producer() const { return m_producer.data(); } Mlt::Consumer *consumer() const { return m_consumer.data(); } const QString &URL() const { return m_url; } const TransportControllable *transportControl() const { return &m_transportControl; } Mlt::Producer *savedProducer() const { return m_savedProducer.data(); } void setSavedProducer(Mlt::Producer *producer); static Mlt::Filter *getFilter(const QString &name, Mlt::Service *service); QString projectFolder() const { return m_projectFolder; } void setProjectFolder(const QString &folderName); QChar decimalPoint(); static void resetLocale(); static int filterIn(Mlt::Playlist &playlist, int clipIndex); static int filterOut(Mlt::Playlist &playlist, int clipIndex); void setPreviewScale(int scale); void updatePreviewProfile(); static void purgeMemoryPool(); static bool fullRange(Mlt::Producer &producer); static bool isMltXml(const QString &s) { return s.contains("<mlt "); } static bool isTrackProducer(Mlt::Producer &producer); static int checkFile(const QString &path); bool blockRefresh(bool block); class RefreshBlocker { public: RefreshBlocker() { singleton().blockRefresh(true); } ~RefreshBlocker() { singleton().blockRefresh(false); } }; protected: Mlt::Repository *m_repo; QScopedPointer<Mlt::Producer> m_producer; QScopedPointer<Mlt::FilteredConsumer> m_consumer; private: Mlt::Profile m_profile; Mlt::Profile m_previewProfile; int m_audioChannels{2}; QScopedPointer<Mlt::Filter> m_jackFilter; QString m_url; double m_volume{1.0}; TransportControl m_transportControl; QScopedPointer<Mlt::Producer> m_savedProducer; QScopedPointer<Mlt::Producer> m_filtersClipboard; unsigned m_skipJackEvents{0}; QString m_projectFolder; QMutex m_saveXmlMutex; bool m_blockRefresh; static void on_jack_started(mlt_properties owner, void *object, mlt_event_data data); void onJackStarted(int position); static void on_jack_stopped(mlt_properties owner, void *object, mlt_event_data data); void onJackStopped(int position); void stopJack(); void initFiltersClipboard(); }; } // namespace #define MLT Mlt::Controller::singleton() #endif // MLTCONTROLLER_H
8,288
C++
.h
233
30.55794
106
0.710268
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,304
mainwindow.h
mltframework_shotcut/src/mainwindow.h
/* * Copyright (c) 2011-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QMutex> #include <QTimer> #include <QUrl> #include <QNetworkAccessManager> #include <QScopedPointer> #include <QSharedPointer> #include <QDateTime> #include "mltcontroller.h" #include "mltxmlchecker.h" #define EXIT_RESTART (42) #define EXIT_RESET (43) namespace Ui { class MainWindow; } class Player; class RecentDock; class EncodeDock; class JobsDock; class PlaylistDock; class QUndoStack; class QActionGroup; class FilterController; class ScopeController; class FiltersDock; class TimelineDock; class AutoSaveFile; class QNetworkReply; class KeyframesDock; class MarkersDock; class NotesDock; class SubtitlesDock; class MainWindow : public QMainWindow { Q_OBJECT public: enum LayoutMode { Custom = 0, Logging, Editing, Effects, Color, Audio, PlayerOnly }; static MainWindow &singleton(); ~MainWindow(); void open(Mlt::Producer *producer); bool continueModified(); bool continueJobsRunning(); QUndoStack *undoStack() const; bool saveXML(const QString &filename, bool withRelativePaths = true); static void changeTheme(const QString &theme); PlaylistDock *playlistDock() const { return m_playlistDock; } TimelineDock *timelineDock() const { return m_timelineDock; } FilterController *filterController() const { return m_filterController; } Mlt::Playlist *playlist() const; bool isPlaylistValid() const; Mlt::Producer *multitrack() const; bool isMultitrackValid() const; void doAutosave(); void setFullScreen(bool isFullScreen); QString untitledFileName() const; void setProfile(const QString &profile_name); QString fileName() const { return m_currentFile; } bool isSourceClipMyProject(QString resource = MLT.resource(), bool withDialog = true); bool keyframesDockIsVisible() const; void keyPressEvent(QKeyEvent *); void keyReleaseEvent(QKeyEvent *); void hideSetDataDirectory(); QMenu *customProfileMenu() const { return m_customProfileMenu; } QAction *actionAddCustomProfile() const; QAction *actionProfileRemove() const; QActionGroup *profileGroup() const { return m_profileGroup; } void buildVideoModeMenu(QMenu *topMenu, QMenu *&customMenu, QActionGroup *group, QAction *addAction, QAction *removeAction); void newProject(const QString &filename, bool isProjectFolder = false); void addCustomProfile(const QString &name, QMenu *menu, QAction *action, QActionGroup *group); void removeCustomProfiles(const QStringList &profiles, QDir &dir, QMenu *menu, QAction *action); QUuid timelineClipUuid(int trackIndex, int clipIndex); void replaceInTimeline(const QUuid &uuid, Mlt::Producer &producer); void replaceAllByHash(const QString &hash, Mlt::Producer &producer, bool isProxy = false); bool isClipboardNewer() const { return m_clipboardUpdatedAt > m_sourceUpdatedAt; } int mltIndexForTrack(int trackIndex) const; int bottomVideoTrackIndex() const; void cropSource(const QRectF &rect); void getMarkerRange(int position, int *start, int *end); void getSelectionRange(int *start, int *end); signals: void audioChannelsChanged(); void producerOpened(bool withReopen = true); void profileChanged(); void openFailed(QString); void aboutToShutDown(); void renameRequested(); void serviceInChanged(int delta, Mlt::Service *); void serviceOutChanged(int delta, Mlt::Service *); protected: MainWindow(); bool eventFilter(QObject *target, QEvent *event); void dragEnterEvent(QDragEnterEvent *); void dropEvent(QDropEvent *); void closeEvent(QCloseEvent *); void showEvent(QShowEvent *); void hideEvent(QHideEvent *event); private: void connectFocusSignals(); void registerDebugCallback(); void connectUISignals(); void setupAndConnectUndoStack(); void setupAndConnectPlayerWidget(); void setupLayoutSwitcher(); void centerLayoutInRemainingToolbarSpace(); void setupAndConnectDocks(); void setupMenuFile(); void setupMenuView(); void connectVideoWidgetSignals(); void setupSettingsMenu(); void setupOpenOtherMenu(); void setupActions(); QAction *addProfile(QActionGroup *actionGroup, const QString &desc, const QString &name); QAction *addLayout(QActionGroup *actionGroup, const QString &name); void readPlayerSettings(); void readWindowSettings(); void writeSettings(); void configureVideoWidget(); void setCurrentFile(const QString &filename); void changeAudioChannels(bool checked, int channels); void changeDeinterlacer(bool checked, const char *method); void changeInterpolation(bool checked, const char *method); bool checkAutoSave(QString &url); bool saveRepairedXmlFile(MltXmlChecker &checker, QString &fileName); void setAudioChannels(int channels); void showSaveError(); void setPreviewScale(int scale); void setVideoModeMenu(); void resetVideoModeMenu(); void resetDockCorners(); void showIncompatibleProjectMessage(const QString &shotcutVersion); void restartAfterChangeTheme(); void backup(); void backupPeriodically(); bool confirmProfileChange(); Ui::MainWindow *ui; Player *m_player; QDockWidget *m_propertiesDock; RecentDock *m_recentDock; EncodeDock *m_encodeDock; JobsDock *m_jobsDock; PlaylistDock *m_playlistDock; TimelineDock *m_timelineDock; QString m_currentFile; bool m_isKKeyPressed; QUndoStack *m_undoStack; QDockWidget *m_historyDock; QActionGroup *m_profileGroup; QActionGroup *m_externalGroup; QActionGroup *m_keyerGroup; QActionGroup *m_layoutGroup; QActionGroup *m_previewScaleGroup; FiltersDock *m_filtersDock; FilterController *m_filterController; ScopeController *m_scopeController; QMenu *m_customProfileMenu; QMenu *m_keyerMenu; QStringList m_multipleFiles; bool m_multipleFilesLoading; bool m_isPlaylistLoaded; QActionGroup *m_languagesGroup; QSharedPointer<AutoSaveFile> m_autosaveFile; QMutex m_autosaveMutex; QTimer m_autosaveTimer; int m_exitCode; QScopedPointer<QAction> m_statusBarAction; QNetworkAccessManager m_network; QString m_upgradeUrl; KeyframesDock *m_keyframesDock; QDateTime m_clipboardUpdatedAt; QDateTime m_sourceUpdatedAt; MarkersDock *m_markersDock; NotesDock *m_notesDock; SubtitlesDock *m_subtitlesDock; std::unique_ptr<QWidget> m_producerWidget; public slots: bool isCompatibleWithGpuMode(MltXmlChecker &checker); bool isXmlRepaired(MltXmlChecker &checker, QString &fileName); bool open(QString url, const Mlt::Properties * = nullptr, bool play = true, bool skipConvert = false); void openMultiple(const QStringList &paths); void openMultiple(const QList<QUrl> &urls); void openVideo(); void openCut(Mlt::Producer *producer, bool play = false); void hideProducer(); void closeProducer(); void showStatusMessage(QAction *action, int timeoutSeconds = 5); void showStatusMessage(const QString &message, int timeoutSeconds = 5, QPalette::ColorRole role = QPalette::ToolTipBase); void onStatusMessageClicked(); void seekPlaylist(int start); void seekTimeline(int position, bool seekPlayer = true); void seekKeyframes(int position); QWidget *loadProducerWidget(Mlt::Producer *producer); void onProducerOpened(bool withReopen = true); void onGpuNotSupported(); void onShuttle(float x); void onPropertiesDockTriggered(bool checked = true); bool on_actionSave_triggered(); void onCreateOrEditFilterOnOutput(Mlt::Filter *filter, const QStringList &key_properties); void showSettingsMenu() const; private slots: void showUpgradePrompt(); void on_actionAbout_Shotcut_triggered(); void on_actionOpenOther_triggered(); void onProducerChanged(); bool on_actionSave_As_triggered(); void onEncodeTriggered(bool checked = true); void onCaptureStateChanged(bool started); void onJobsDockTriggered(bool = true); void onRecentDockTriggered(bool checked = true); void onPlaylistDockTriggered(bool checked = true); void onTimelineDockTriggered(bool checked = true); void onHistoryDockTriggered(bool checked = true); void onFiltersDockTriggered(bool checked = true); void onKeyframesDockTriggered(bool checked = true); void onMarkersDockTriggered(bool = true); void onNotesDockTriggered(bool = true); void onSubtitlesDockTriggered(bool = true); void onPlaylistCreated(); void onPlaylistLoaded(); void onPlaylistCleared(); void onPlaylistClosed(); void onPlaylistModified(); void onMultitrackCreated(); void onMultitrackClosed(); void onMultitrackModified(); void onMultitrackDurationChanged(); void onNoteModified(); void onSubtitleModified(); void onCutModified(); void onProducerModified(); void onFilterModelChanged(); void updateMarkers(); void updateThumbnails(); void on_actionUndo_triggered(); void on_actionRedo_triggered(); void on_actionFAQ_triggered(); void on_actionForum_triggered(); void on_actionEnterFullScreen_triggered(); void on_actionRealtime_triggered(bool checked); void on_actionProgressive_triggered(bool checked); void on_actionChannels1_triggered(bool checked); void on_actionChannels2_triggered(bool checked); void on_actionChannels4_triggered(bool checked); void on_actionChannels6_triggered(bool checked); void on_actionOneField_triggered(bool checked); void on_actionLinearBlend_triggered(bool checked); void on_actionYadifTemporal_triggered(bool checked); void on_actionYadifSpatial_triggered(bool checked); void on_actionBwdif_triggered(bool checked); void on_actionNearest_triggered(bool checked); void on_actionBilinear_triggered(bool checked); void on_actionBicubic_triggered(bool checked); void on_actionHyper_triggered(bool checked); void on_actionJack_triggered(bool checked); void on_actionGPU_triggered(bool checked); void onExternalTriggered(QAction *); void onKeyerTriggered(QAction *); void onProfileTriggered(QAction *); void onProfileChanged(); void on_actionAddCustomProfile_triggered(); void processMultipleFiles(); void processSingleFile(); void onLanguageTriggered(QAction *); void on_actionSystemTheme_triggered(); void on_actionFusionDark_triggered(); void on_actionJobPriorityLow_triggered(); void on_actionJobPriorityNormal_triggered(); void on_actionFusionLight_triggered(); void on_actionTutorials_triggered(); void on_actionRestoreLayout_triggered(); void on_actionShowTitleBars_triggered(bool checked); void on_actionShowToolbar_triggered(bool checked); void onToolbarVisibilityChanged(bool visible); void on_menuExternal_aboutToShow(); void on_actionUpgrade_triggered(); void on_actionOpenXML_triggered(); void on_actionShowProjectFolder_triggered(); void onAutosaveTimeout(); void onFocusChanged(QWidget *old, QWidget *now) const; void onFocusObjectChanged(QObject *obj) const; void onFocusWindowChanged(QWindow *window) const; void onTimelineClipSelected(); void onAddAllToTimeline(Mlt::Playlist *playlist, bool skipProxy, bool emptyTrack); void on_actionScrubAudio_triggered(bool checked); #if !defined(Q_OS_MAC) void onDrawingMethodTriggered(QAction *); #endif void on_actionResources_triggered(); void on_actionApplicationLog_triggered(); void on_actionClose_triggered(); void onPlayerTabIndexChanged(int index); void onUpgradeCheckFinished(QNetworkReply *reply); void onUpgradeTriggered(); void onClipCopied(); void on_actionExportEDL_triggered(); void on_actionExportFrame_triggered(); void onVideoWidgetImageReady(); void on_actionAppDataSet_triggered(); void on_actionAppDataShow_triggered(); void on_actionNew_triggered(); void on_actionKeyboardShortcuts_triggered(); void on_actionLayoutLogging_triggered(); void on_actionLayoutEditing_triggered(); void on_actionLayoutEffects_triggered(); void on_actionLayoutColor_triggered(); void on_actionLayoutAudio_triggered(); void on_actionLayoutPlayer_triggered(); void on_actionLayoutPlaylist_triggered(); void on_actionLayoutClip_triggered(); void on_actionLayoutAdd_triggered(); void onLayoutTriggered(QAction *); void on_actionProfileRemove_triggered(); void on_actionLayoutRemove_triggered(); void on_actionOpenOther2_triggered(); void onOpenOtherTriggered(QWidget *widget); void onOpenOtherFinished(int result); void onOpenOtherTriggered(); void on_actionClearRecentOnExit_toggled(bool arg1); void onSceneGraphInitialized(); void on_actionShowTextUnderIcons_toggled(bool b); void on_actionShowSmallIcons_toggled(bool b); void onPlaylistInChanged(int in); void onPlaylistOutChanged(int out); void on_actionPreviewNone_triggered(bool checked); void on_actionPreview360_triggered(bool checked); void on_actionPreview540_triggered(bool checked); void on_actionPreview720_triggered(bool checked); void on_actionTopics_triggered(); void on_actionSync_triggered(); void on_actionUseProxy_triggered(bool checked); void on_actionProxyStorageSet_triggered(); void on_actionProxyStorageShow_triggered(); void on_actionProxyUseProjectFolder_triggered(bool checked); void on_actionProxyUseHardware_triggered(bool checked); void on_actionProxyConfigureHardware_triggered(); void updateLayoutSwitcher(); void clearCurrentLayout(); void onClipboardChanged(); void sourceUpdated(); void resetSourceUpdated(); void on_actionExportChapters_triggered(); void on_actionAudioVideoDevice_triggered(); void on_actionReset_triggered(); void on_actionBackupSave_triggered(); }; #define MAIN MainWindow::singleton() #endif // MAINWINDOW_H
15,021
C++
.h
397
33.047859
100
0.749247
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,305
actions.h
mltframework_shotcut/src/actions.h
/* * Copyright (c) 2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ACTIONS_H #define ACTIONS_H #include <QHash> #include <QObject> class QAction; class QMenu; class ShotcutActions : public QObject { Q_OBJECT public: static const char *hardKeyProperty; static const char *displayProperty; static const char *defaultKey1Property; static const char *defaultKey2Property; static const char *defaultToolTipProperty; static ShotcutActions &singleton(); explicit ShotcutActions() : QObject() {} void add(const QString &name, QAction *action, QString group = ""); void loadFromMenu(QMenu *menu, const QString group = ""); QAction *operator [](const QString &key); QList<QString> keys(); void overrideShortcuts(const QString &key, QList<QKeySequence> shortcuts); void initializeShortcuts(); private: void addShortcutToToolTip(QAction *action); QHash<QString, QAction *> m_actions; }; #define Actions ShotcutActions::singleton() #endif // ACTIONS_H
1,648
C++
.h
45
33.622222
78
0.751884
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,306
macos.h
mltframework_shotcut/src/macos.h
/* * Copyright (c) 2019 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once void removeMacosTabBar();
734
C++
.h
18
38.833333
72
0.760504
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,307
transcoder.h
mltframework_shotcut/src/transcoder.h
/* * Copyright (c) 2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TRANSCODER_H #define TRANSCODER_H #include "dialogs/transcodedialog.h" #include <MltProducer.h> #include <QList> #include <QObject> class Transcoder : public QObject { Q_OBJECT public: explicit Transcoder() : QObject() {} void setProducers(QList<Mlt::Producer> &producers); void addProducer(Mlt::Producer &producer); void addProducer(Mlt::Producer *producer); void convert(TranscodeDialog &dialog); private: void convertProducer(Mlt::Producer *producer, TranscodeDialog &dialog, QString filename); QList<Mlt::Producer> m_producers; }; #endif // TRANSCODER_H
1,300
C++
.h
36
33.555556
93
0.757769
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,308
encodedock.h
mltframework_shotcut/src/docks/encodedock.h
/* * Copyright (c) 2012-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ENCODEDOCK_H #define ENCODEDOCK_H #include "settings.h" #include <QDockWidget> #include <QDomElement> #include <QStandardItemModel> #include <QSortFilterProxyModel> #include <QStringList> #include <MltProperties.h> class QTreeWidgetItem; class QTemporaryFile; namespace Ui { class EncodeDock; } class AbstractJob; class MeltJob; namespace Mlt { class Service; class Producer; class Filter; } class PresetsProxyModel : public QSortFilterProxyModel { protected: bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; }; class EncodeDock : public QDockWidget { Q_OBJECT public: explicit EncodeDock(QWidget *parent = 0); ~EncodeDock(); void loadPresetFromProperties(Mlt::Properties &); bool isExportInProgress() const; signals: void captureStateChanged(bool); void createOrEditFilterOnOutput(Mlt::Filter *, const QStringList & = {}); public slots: void onAudioChannelsChanged(); void onProducerOpened(); void onProfileChanged(); void onReframeChanged(); void on_hwencodeButton_clicked(); bool detectHardwareEncoders(); private slots: void on_presetsTree_clicked(const QModelIndex &index); void on_presetsTree_activated(const QModelIndex &index); void on_encodeButton_clicked(); void on_streamButton_clicked(); void on_addPresetButton_clicked(); void on_removePresetButton_clicked(); void onFinished(AbstractJob *, bool isSuccess); void on_stopCaptureButton_clicked(); void on_videoRateControlCombo_activated(int index); void on_audioRateControlCombo_activated(int index); void on_scanModeCombo_currentIndexChanged(int index); void on_presetsSearch_textChanged(const QString &search); void on_resetButton_clicked(); void openCaptureFile(); void on_formatCombo_currentIndexChanged(int index); void on_videoBufferDurationChanged(); void on_gopSpinner_valueChanged(int value); void on_fromCombo_currentIndexChanged(int index); void on_videoCodecCombo_currentIndexChanged(int index); void on_audioCodecCombo_currentIndexChanged(int index); void setAudioChannels( int channels ); void on_widthSpinner_editingFinished(); void on_heightSpinner_editingFinished(); void on_advancedButton_clicked(bool checked); void on_hwencodeCheckBox_clicked(bool checked); void on_advancedCheckBox_clicked(bool checked); void on_fpsSpinner_editingFinished(); void on_fpsComboBox_activated(int arg1); void on_videoQualitySpinner_valueChanged(int vq); void on_audioQualitySpinner_valueChanged(int aq); void on_parallelCheckbox_clicked(bool checked); void on_resolutionComboBox_activated(int arg1); void on_reframeButton_clicked(); void on_aspectNumSpinner_valueChanged(int value); void on_aspectDenSpinner_valueChanged(int value); private: enum { RateControlAverage = 0, RateControlConstant, RateControlQuality, RateControlConstrained }; enum { AudioChannels1 = 0, AudioChannels2, AudioChannels4, AudioChannels6, }; Ui::EncodeDock *ui; Mlt::Properties *m_presets; QScopedPointer<MeltJob> m_immediateJob; QString m_extension; Mlt::Properties *m_profiles; PresetsProxyModel m_presetsModel; QStringList m_outputFilenames; bool m_isDefaultSettings; double m_fps; QStringList m_intraOnlyCodecs; QStringList m_losslessVideoCodecs; QStringList m_losslessAudioCodecs; void loadPresets(); Mlt::Properties *collectProperties(int realtime, bool includeProfile = false); void collectProperties(QDomElement &node, int realtime); void setSubtitleProperties(QDomElement &node, Mlt::Producer *service); QPoint addConsumerElement(Mlt::Producer *service, QDomDocument &dom, const QString &target, int realtime, int pass); MeltJob *convertReframe(Mlt::Producer *service, QTemporaryFile *tmp, const QString &target, int realtime, int pass, const QThread::Priority priority); MeltJob *createMeltJob(Mlt::Producer *service, const QString &target, int realtime, int pass = 0, const QThread::Priority priority = Settings.jobPriority()); void runMelt(const QString &target, int realtime = -1); void enqueueAnalysis(); void enqueueMelt(const QStringList &targets, int realtime); void encode(const QString &target); void resetOptions(); Mlt::Producer *fromProducer() const; static void filterCodecParams(const QString &vcodec, QStringList &other); void onVideoCodecComboChanged(int index, bool ignorePreset = false, bool resetBframes = true); bool checkForMissingFiles(); QString &defaultFormatExtension(); void initSpecialCodecLists(); void setReframeEnabled(bool enabled); void showResampleWarning(const QString &message); void hideResampleWarning(bool hide = true); void checkFrameRate(); void setResolutionAspectFromProfile(); }; #endif // ENCODEDOCK_H
5,778
C++
.h
149
34
101
0.750806
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,309
jobsdock.h
mltframework_shotcut/src/docks/jobsdock.h
/* * Copyright (c) 2012-2020 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef JOBSDOCK_H #define JOBSDOCK_H #include <QDockWidget> class AbstractJob; class QStandardItem; namespace Ui { class JobsDock; } class JobsDock : public QDockWidget { Q_OBJECT public: explicit JobsDock(QWidget *parent = 0); ~JobsDock(); AbstractJob *currentJob() const; public slots: void onJobAdded(); void onProgressUpdated(QStandardItem *item, int percent); protected: void resizeEvent(QResizeEvent *event); private: Ui::JobsDock *ui; private slots: void on_treeView_customContextMenuRequested(const QPoint &pos); void on_actionStopJob_triggered(); void on_actionViewLog_triggered(); void on_pauseButton_toggled(bool checked); void on_actionRun_triggered(); void on_menuButton_clicked(); void on_treeView_doubleClicked(const QModelIndex &index); void on_actionRemove_triggered(); void on_actionRemoveFinished_triggered(); void on_JobsDock_visibilityChanged(bool visible); }; #endif // JOBSDOCK_H
1,685
C++
.h
51
30.117647
72
0.759088
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,310
recentdock.h
mltframework_shotcut/src/docks/recentdock.h
/* * Copyright (c) 2012-2020 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef RECENTDOCK_H #define RECENTDOCK_H #include <QDockWidget> #include <QStandardItemModel> #include <QSortFilterProxyModel> namespace Ui { class RecentDock; } class RecentDock : public QDockWidget { Q_OBJECT public: explicit RecentDock(QWidget *parent = 0); ~RecentDock(); signals: void itemActivated(const QString &url); void deleted(const QString &url); public slots: void add(const QString &); QString remove(const QString &s); void find(); protected: void keyPressEvent(QKeyEvent *event); private: Ui::RecentDock *ui; QStringList m_recent; QStandardItemModel m_model; QSortFilterProxyModel m_proxyModel; private slots: void on_listWidget_activated(const QModelIndex &i); void on_lineEdit_textChanged(const QString &search); void on_actionDelete_triggered(); void on_listWidget_customContextMenuRequested(const QPoint &pos); }; #endif // RECENTDOCK_H
1,635
C++
.h
51
29.215686
72
0.759059
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,311
notesdock.h
mltframework_shotcut/src/docks/notesdock.h
/* * Copyright (c) 2022-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef NOTESDOCK_H #define NOTESDOCK_H #include <QDockWidget> #include <QObject> class TextEditor; class NotesDock : public QDockWidget { Q_OBJECT public: explicit NotesDock(QWidget *parent = 0); QString getText(); void setText(const QString &text); signals: void modified(); private slots: void onTextChanged(); private: TextEditor *m_textEdit; bool m_blockUpdate; }; #endif // NOTESDOCK_H
1,131
C++
.h
37
28.054054
72
0.752074
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,312
filtersdock.h
mltframework_shotcut/src/docks/filtersdock.h
/* * Copyright (c) 2013-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef FILTERSDOCK_H #define FILTERSDOCK_H #include <QDockWidget> #include <QObject> #include <QQuickView> #include <QQuickWidget> #include "sharedframe.h" #include "qmltypes/qmlproducer.h" class QmlFilter; class QmlMetadata; class MetadataModel; class AttachedFiltersModel; class MotionTrackerModel; class SubtitlesModel; class FiltersDock : public QDockWidget { Q_OBJECT public: explicit FiltersDock(MetadataModel *metadataModel, AttachedFiltersModel *attachedModel, MotionTrackerModel *motionTrackerModel, SubtitlesModel *subtitlesModel, QWidget *parent = 0); QmlProducer *qmlProducer() { return &m_producer; } signals: void currentFilterRequested(int attachedIndex); void changed(); /// Notifies when a filter parameter changes. void seeked(int); void producerInChanged(int delta); void producerOutChanged(int delta); public slots: void setCurrentFilter(QmlFilter *filter, QmlMetadata *meta, int index); void onSeeked(int position); void onShowFrame(const SharedFrame &frame); void openFilterMenu() const; void onServiceInChanged(int delta, Mlt::Service *service); void load(); protected: bool event(QEvent *event); void keyPressEvent(QKeyEvent *event); private: void setupActions(); QQuickWidget m_qview; QmlProducer m_producer; unsigned loadTries {0}; }; #endif // FILTERSDOCK_H
2,142
C++
.h
64
29.765625
96
0.749758
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,313
scopedock.h
mltframework_shotcut/src/docks/scopedock.h
/* * Copyright (c) 2015 Meltytech, LLC * Author: Brian Matherly <code@brianmatherly.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SCOPEDOCK_H #define SCOPEDOCK_H #include "widgets/scopes/scopewidget.h" #include <QDockWidget> #include <QObject> class ScopeController; class ScopeDock Q_DECL_FINAL : public QDockWidget { Q_OBJECT public: explicit ScopeDock(ScopeController *scopeController, ScopeWidget *scopeWidget); protected: void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE; private: ScopeController *m_scopeController; ScopeWidget *m_scopeWidget; void setWidget(QWidget *widget); // Private to disallow use private slots: void onActionToggled(bool checked); }; #endif // SCOPEDOCK_H
1,347
C++
.h
38
33.026316
83
0.772132
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,314
keyframesdock.h
mltframework_shotcut/src/docks/keyframesdock.h
/* * Copyright (c) 2016-2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef KEYFRAMESDOCK_H #define KEYFRAMESDOCK_H #include "qmltypes/qmlfilter.h" #include "models/keyframesmodel.h" #include <QDockWidget> #include <QQuickWidget> #include <QScopedPointer> class QmlFilter; class QmlMetadata; class AttachedFiltersModel; class QmlProducer; class QMenu; class KeyframesDock : public QDockWidget { Q_OBJECT Q_PROPERTY(double timeScale READ timeScale WRITE setTimeScale NOTIFY timeScaleChanged) public: explicit KeyframesDock(QmlProducer *qmlProducer, QWidget *parent = 0); KeyframesModel &model() { return m_model; } Q_INVOKABLE int seekPrevious(); Q_INVOKABLE int seekNext(); int currentParameter() const; double timeScale() const { return m_timeScale; } void setTimeScale(double value); signals: void changed(); /// Notifies when a filter parameter changes. void setZoom(double value); void zoomIn(); void zoomOut(); void zoomToFit(); void resetZoom(); void seekPreviousSimple(); void seekNextSimple(); void newFilter(); // Notifies when the filter itself has been changed void timeScaleChanged(); void dockClicked(); public slots: void setCurrentFilter(QmlFilter *filter, QmlMetadata *meta); void load(bool force = false); void reload(); void onProducerModified(); protected: bool event(QEvent *event); void keyPressEvent(QKeyEvent *event); void keyReleaseEvent(QKeyEvent *event); private slots: void onDockRightClicked(); void onKeyframeRightClicked(); void onClipRightClicked(); private: void setupActions(); QQuickWidget m_qview; KeyframesModel m_model; QmlMetadata *m_metadata; QmlFilter *m_filter; QmlProducer *m_qmlProducer; QMenu *m_mainMenu; QMenu *m_keyMenu; QMenu *m_keyTypePrevMenu; QMenu *m_keyTypeNextMenu; QMenu *m_clipMenu; double m_timeScale {1.0}; }; #endif // KEYFRAMESDOCK_H
2,637
C++
.h
86
27.011628
90
0.738377
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,315
subtitlesdock.h
mltframework_shotcut/src/docks/subtitlesdock.h
/* * Copyright (c) 2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SUBTITLESDOCK_H #define SUBTITLESDOCK_H #include "MltPlaylist.h" #include <QDockWidget> class SubtitlesModel; class SubtitlesSelectionModel; class QComboBox; class QItemSelection; class QLabel; class QTextEdit; class QTreeView; class SubtitlesDock : public QDockWidget { Q_OBJECT public: explicit SubtitlesDock(QWidget *parent = 0); ~SubtitlesDock(); void setModel(SubtitlesModel *model, SubtitlesSelectionModel *selectionModel); void importSrtFromFile(const QString &srtPath, const QString &trackName, const QString &lang, bool includeNonspoken); signals: void seekRequested(int pos); void addAllTimeline(Mlt::Playlist *, bool skipProxy, bool emptyTrack); void createOrEditFilterOnOutput(Mlt::Filter *, const QStringList &key_properties); private slots: void onPositionChanged(int position); void onStartColumnToggled(bool checked); void onEndColumnToggled(bool checked); void onDurationColumnToggled(bool checked); protected: void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE; private: void setupActions(); void onCreateOrEditRequested(); void onAddRequested(); void onRemoveRequested(); void onSetStartRequested(); void onSetEndRequested(); void onMoveRequested(); void onTextEdited(); void onModelReset(); void updateActionAvailablity(); void addSubtitleTrack(); void removeSubtitleTrack(); void editSubtitleTrack(); void refreshTracksCombo(); void importSubtitles(); void exportSubtitles(); void onItemDoubleClicked(const QModelIndex &index); void resizeTextWidgets(); void updateTextWidgets(); void setCurrentItem(int trackIndex, int itemIndex); void refreshWidgets(); void selectItemForTime(); QString availableTrackName(); bool trackNameExists(const QString &name); void ensureTrackExists(); void burnInOnTimeline(); void generateTextOnTimeline(); void speechToText(); bool findWhisperExe(); SubtitlesModel *m_model; SubtitlesSelectionModel *m_selectionModel; QLabel *m_addToTimelineLabel; QComboBox *m_trackCombo; QTreeView *m_treeView; QTextEdit *m_text; QTextEdit *m_prev; QTextEdit *m_next; QLabel *m_prevLabel; QLabel *m_textLabel; QLabel *m_nextLabel; int m_pos; bool m_textEditInProgress; }; #endif // SUBTITLESDOCK_H
3,092
C++
.h
92
29.630435
97
0.751673
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,316
playlistdock.h
mltframework_shotcut/src/docks/playlistdock.h
/* * Copyright (c) 2012-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef PLAYLISTDOCK_H #define PLAYLISTDOCK_H #include <QDockWidget> #include <QUndoCommand> #include <QTimer> #include "models/playlistmodel.h" namespace Ui { class PlaylistDock; } class QAbstractItemView; class QItemSelectionModel; class QMenu; class PlaylistIconView; class PlaylistDock : public QDockWidget { Q_OBJECT public: explicit PlaylistDock(QWidget *parent = 0); ~PlaylistDock(); PlaylistModel *model() { return &m_model; } int position(); void replaceClipsWithHash(const QString &hash, Mlt::Producer &producer); void getSelectionRange(int *start, int *end); signals: void clipOpened(Mlt::Producer *producer, bool play = false); void itemActivated(int start); void showStatusMessage(QString); void addAllTimeline(Mlt::Playlist *, bool skipProxy = false, bool emptyTrack = false); void producerOpened(); void selectionChanged(); void enableUpdate(bool); public slots: void onOpenActionTriggered(); void onAppendCutActionTriggered(); void onProducerOpened(); void onInChanged(); void onOutChanged(); void onProducerChanged(Mlt::Producer *producer); void onProducerModified(); void onPlayerDragStarted(); void onPlaylistModified(); void onPlaylistCreated(); void onPlaylistLoaded(); void onPlaylistCleared(); private slots: void viewCustomContextMenuRequested(const QPoint &pos); void viewDoubleClicked(const QModelIndex &index); void onDropped(const QMimeData *data, int row); void onMoveClip(int from, int to); void onMovedToEnd(); void onInTimerFired(); void onOutTimerFired(); protected: void keyPressEvent(QKeyEvent *event); void keyReleaseEvent(QKeyEvent *event); private: void setupActions(); void resetPlaylistIndex(); void emitDataChanged(const QVector<int> &roles); void setPlaylistIndex(Mlt::Producer *producer, int row); void updateViewMode(); void onAddFilesActionTriggered(); void onUpdateThumbnailsActionTriggered(); void onAddToTimelineActionTriggered(); void onAddToSlideshowActionTriggered(); void onSetFileDateActionTriggered(); void onRemoveAllActionTriggered(); void onGotoActionTriggered(); void onCopyActionTriggered(); void onSelectAllActionTriggered(); void onInsertCutActionTriggered(); void onUpdateActionTriggered(); void onRemoveActionTriggered(); void incrementIndex(); void decrementIndex(); void setIndex(int row); void moveClipUp(); void moveClipDown(); void addFiles(int row, const QList<QUrl> &urls); Ui::PlaylistDock *ui; QAbstractItemView *m_view; PlaylistIconView *m_iconsView; PlaylistModel m_model; QItemSelectionModel *m_selectionModel; int m_defaultRowHeight; QTimer m_inChangedTimer; QTimer m_outChangedTimer; QMenu *m_mainMenu; bool m_blockResizeColumnsToContents; }; #endif // PLAYLISTDOCK_H
3,645
C++
.h
110
29.254545
90
0.750923
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,317
markersdock.h
mltframework_shotcut/src/docks/markersdock.h
/* * Copyright (c) 2021 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MARKERSDOCK_H #define MARKERSDOCK_H #include <QDockWidget> #include <QItemSelectionModel> class EditMarkerWidget; class MarkerTreeView; class MarkersModel; class QLineEdit; class QSortFilterProxyModel; class QToolButton; class MarkersDock : public QDockWidget { Q_OBJECT public: explicit MarkersDock(QWidget *parent = 0); ~MarkersDock(); void setModel(MarkersModel *model); signals: void seekRequested(int pos); void addRequested(); void addAroundSelectionRequested(); public slots: void onMarkerSelectionRequest(int markerIndex); private slots: void onSelectionChanged(QModelIndex &index); void onRowClicked(const QModelIndex &index); void onAddRequested(); void onRemoveRequested(); void onClearSelectionRequested(); void onRemoveAllRequested(); void onSearchChanged(); void onColorColumnToggled(bool checked); void onTextColumnToggled(bool checked); void onStartColumnToggled(bool checked); void onEndColumnToggled(bool checked); void onDurationColumnToggled(bool checked); void onRowsInserted(const QModelIndex &parent, int first, int last); void onDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>()); void onValuesChanged(); void onModelReset(); void onSortIndicatorChanged(int logicalIndex, Qt::SortOrder order); private: void enableButtons(bool enable); MarkersModel *m_model; QSortFilterProxyModel *m_proxyModel; MarkerTreeView *m_treeView; QToolButton *m_addButton; QToolButton *m_removeButton; QToolButton *m_clearButton; QLineEdit *m_searchField; QToolButton *m_clearSearchButton; EditMarkerWidget *m_editMarkerWidget; bool m_editInProgress; }; #endif // MARKERSDOCK_H
2,523
C++
.h
72
31.361111
82
0.764344
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,318
timelinedock.h
mltframework_shotcut/src/docks/timelinedock.h
/* * Copyright (c) 2013-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TIMELINEDOCK_H #define TIMELINEDOCK_H #include <QDockWidget> #include <QQuickWidget> #include <QApplication> #include <QTimer> #include <QDateTime> #include "models/markersmodel.h" #include "models/multitrackmodel.h" #include "models/subtitlesmodel.h" #include "models/subtitlesselectionmodel.h" #include "sharedframe.h" #include "jobs/ffmpegjob.h" namespace Timeline { class UpdateCommand; class TrimCommand; } class UndoHelper; class QMenu; class TimelineDock : public QDockWidget { Q_OBJECT Q_PROPERTY(int position READ position WRITE setPosition NOTIFY positionChanged) Q_PROPERTY(int currentTrack READ currentTrack WRITE setCurrentTrack NOTIFY currentTrackChanged) Q_PROPERTY(QVariantList selection READ selectionForJS WRITE setSelectionFromJS NOTIFY selectionChanged) Q_PROPERTY(bool isRecording READ isRecording NOTIFY isRecordingChanged) Q_PROPERTY(int loopStart READ loopStart NOTIFY loopChanged) Q_PROPERTY(int loopEnd READ loopEnd NOTIFY loopChanged) public: explicit TimelineDock(QWidget *parent = 0); ~TimelineDock(); enum TrimLocation { TrimInPoint, TrimOutPoint }; MultitrackModel *model() { return &m_model; } MarkersModel *markersModel() { return & m_markersModel; } SubtitlesModel *subtitlesModel() { return & m_subtitlesModel; } SubtitlesSelectionModel *subtitlesSelectionModel() { return & m_subtitlesSelectionModel; } int position() const { return m_position; } void setPosition(int position); Mlt::Producer producerForClip(int trackIndex, int clipIndex); int clipIndexAtPlayhead(int trackIndex = -1); int clipIndexAtPosition(int trackIndex, int position); void chooseClipAtPosition(int position, int &trackIndex, int &clipIndex); void setCurrentTrack(int currentTrack); int currentTrack() const; int clipCount(int trackIndex) const; void setSelectionFromJS(const QVariantList &list); void setSelection(QList<QPoint> selection = QList<QPoint>(), int trackIndex = -1, bool isMultitrack = false); QVariantList selectionForJS() const; const QList<QPoint> selection() const; const QVector<QUuid> selectionUuids(); const QList<QPoint> uuidsToSelection(QVector<QUuid> uuids) const; void saveAndClearSelection(); Q_INVOKABLE void restoreSelection(); Q_INVOKABLE QVariantList getGroupForClip(int trackIndex, int clipIndex); void selectClipUnderPlayhead(); int centerOfClip(int trackIndex, int clipIndex); bool isTrackLocked(int trackIndex) const; void trimClipAtPlayhead(TrimLocation location, bool ripple); Q_INVOKABLE bool isMultitrackSelected() const { return m_selection.isMultitrackSelected; } Q_INVOKABLE int selectedTrack() const { return m_selection.selectedTrack; } Q_INVOKABLE bool isFloating() const { return QDockWidget::isFloating(); } Q_INVOKABLE static void openProperties(); void emitSelectedChanged(const QVector<int> &roles); void replaceClipsWithHash(const QString &hash, Mlt::Producer &producer); Q_INVOKABLE void recordAudio(); Q_INVOKABLE void stopRecording(); bool isRecording() const { return m_isRecording; } int addTrackIfNeeded(TrackType trackType); void getSelectionRange(int *start, int *end); int loopStart() const { return m_loopStart; } int loopEnd() const { return m_loopEnd; } signals: void currentTrackChanged(); void selectionChanged(); void seeked(int position); void positionChanged(int position); void loopChanged(); void clipOpened(Mlt::Producer *producer); void dragging(const QPointF &pos, int duration); void dropped(); void dropAccepted(const QString &xml); void fadeInChanged(int duration); void fadeOutChanged(int duration); void selected(Mlt::Producer *producer); void clipClicked(); void showStatusMessage(QString); void clipCopied(); void clipMoved(int fromTrack, int toTrack, int clipIndex, int position, bool ripple); void filteredClicked(); void durationChanged(); void transitionAdded(int trackIndex, int clipIndex, int position, bool ripple); void zoomIn(); void zoomOut(); void zoomToFit(); void setZoom(double value); void markerRangesChanged(); void markerSeeked(int markerIndex); void isRecordingChanged(bool); void multitrackSelected(); void warnTrackLocked(int trackIndex); void refreshWaveforms(); void updateThumbnails(int trackIndex, int clipIndex); public slots: int addAudioTrack(); int addVideoTrack(); void alignSelectedClips(); void onShowFrame(const SharedFrame &frame); void onSeeked(int position); void append(int trackIndex); void remove(int trackIndex, int clipIndex, bool ignoreTransition = false); bool mergeClipWithNext(int trackIndex, int clipIndex, bool dryrun); void lift(int trackIndex, int clipIndex, bool ignoreTransition = false); void removeSelection(bool withCopy = false); void liftSelection(); void incrementCurrentTrack(int by); void selectTrackHead(int trackIndex); void selectMultitrack(); void copy(int trackIndex, int clipIndex); void setTrackName(int trackIndex, const QString &value); void toggleTrackMute(int trackIndex); void toggleTrackHidden(int trackIndex); void setTrackComposite(int trackIndex, bool composite); void setTrackLock(int trackIndex, bool lock); bool moveClip(int fromTrack, int toTrack, int clipIndex, int position, bool ripple); void onClipMoved(int fromTrack, int toTrack, int clipIndex, int position, bool ripple); bool trimClipIn(int trackIndex, int clipIndex, int oldClipIndex, int delta, bool ripple); bool trimClipOut(int trackIndex, int clipIndex, int delta, bool ripple); void insert(int trackIndex, int position = -1, const QString &xml = QString(), bool seek = true); void overwrite(int trackIndex, int position = -1, const QString &xml = QString(), bool seek = true); void appendFromPlaylist(Mlt::Playlist *playlist, bool skipProxy, bool emptyTrack); void fadeIn(int trackIndex, int clipIndex = -1, int duration = -1); void fadeOut(int trackIndex, int clipIndex = -1, int duration = -1); void seekPreviousEdit(); void seekNextEdit(); void seekInPoint(int clipIndex); void clearSelectionIfInvalid(); void insertTrack(); void insertAudioTrack(); void insertVideoTrack(); void removeTrack(); void moveTrack(int fromTrackIndex, int toTrackIndex); void moveTrackUp(); void moveTrackDown(); void onProducerChanged(Mlt::Producer *); void emitSelectedFromSelection(); void remakeAudioLevels(int trackIndex, int clipIndex, bool force = true); void commitTrimCommand(); void onRowsInserted(const QModelIndex &parent, int first, int last); void onRowsRemoved(const QModelIndex &parent, int first, int last); void onRowsMoved(const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row); void detachAudio(int trackIndex, int clipIndex); void selectAll(); void selectAllOnCurrentTrack(); void onProducerModified(); void replace(int trackIndex, int clipIndex, const QString &xml = QString()); void createOrEditMarker(); void createOrEditSelectionMarker(); void createMarker(); void editMarker(int markerIndex); void deleteMarker(int markerIndex = -1); void seekNextMarker(); void seekPrevMarker(); void onFilterModelChanged(); void trimClipIn(bool ripple = false); void trimClipOut(bool ripple = false); void initLoad(); void handleDrop(int trackIndex, int position, QString xml); void onLoopChanged(int start, int end); protected: void dragEnterEvent(QDragEnterEvent *event); void dragMoveEvent(QDragMoveEvent *event); void dragLeaveEvent(QDragLeaveEvent *event); void dropEvent(QDropEvent *event); bool event(QEvent *event); void keyPressEvent(QKeyEvent *event); void keyReleaseEvent(QKeyEvent *event); private: bool isBlank(int trackIndex, int clipIndex); bool clipsAreSelected(); bool blankIsSelected(); bool nothingIsSelected(); bool isTransition(int trackIndex, int clipIndex); void emitNonSeekableWarning(); void addTrackIfNeeded(int mltTrackIndex, Mlt::Producer *srcTrack); void setupActions(); bool isMultitrackValid() { return m_model.tractor() && !m_model.trackList().empty(); } void reportSelectionChange(); void applyCopiedFiltersToSelectdClips(); void insertOrOverwriteDrop(int trackIndex, int position, const QString &xml); QQuickWidget m_quickView; MultitrackModel m_model; MarkersModel m_markersModel; SubtitlesModel m_subtitlesModel; SubtitlesSelectionModel m_subtitlesSelectionModel; int m_position; std::unique_ptr<Timeline::UpdateCommand> m_updateCommand; bool m_ignoreNextPositionChange; struct Selection { QList<QPoint> selectedClips; // x is the clip index, y is the track index int selectedTrack; bool isMultitrackSelected; }; Selection m_selection; int m_savedSelectedTrack; bool m_savedIsMultitrackSelected; QVector<QUuid> m_savedSelectionUuids; QTimer m_selectionSignalTimer; std::unique_ptr<Timeline::TrimCommand> m_trimCommand; std::unique_ptr<UndoHelper> m_undoHelper; int m_trimDelta; int m_transitionDelta; bool m_isRecording {false}; std::unique_ptr<AbstractJob> m_recordJob; QTimer m_recordingTimer; QDateTime m_recordingTime; int m_recordingTrackIndex; int m_recordingClipIndex; int m_currentTrack {0}; QMenu *m_mainMenu; QMenu *m_clipMenu; int m_loopStart; int m_loopEnd; private slots: void load(bool force); void onTopLevelChanged(bool floating); void onTransitionAdded(int trackIndex, int clipIndex, int position, bool ripple); void selectClip(int trackIndex, int clipIndex); void onMultitrackClosed(); void reloadTimelineModels(); void onRecordStarted(); void updateRecording(); void onRecordFinished(AbstractJob *, bool); void onWarnTrackLocked(); void onTimelineRightClicked(); void onClipRightClicked(); void onNoMoreEmptyTracks(bool isAudio); }; #endif // TIMELINEDOCK_H
11,206
C++
.h
296
32.983108
104
0.736692
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,319
filedialog.h
mltframework_shotcut/src/qmltypes/filedialog.h
/* * Copyright (c) 2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef FILEDIALOG_H #define FILEDIALOG_H #include <QFileDialog> class FileDialog : public QObject { Q_OBJECT Q_PROPERTY(FileDialog::FileMode fileMode READ fileMode WRITE setFileMode NOTIFY fileModeChanged) Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged) Q_PROPERTY(QStringList nameFilters READ nameFilters WRITE setNameFilters NOTIFY nameFiltersChanged) Q_PROPERTY(QString selectedFile READ selectedFile NOTIFY fileSelected) public: enum FileMode {OpenFile, SaveFile}; Q_ENUM(FileMode) explicit FileDialog(QObject *parent = nullptr); FileDialog::FileMode fileMode() const { return m_fileMode; } void setFileMode(FileDialog::FileMode mode); QString title() const; void setTitle(const QString &title); QStringList nameFilters() const; void setNameFilters(const QStringList &filters); QString selectedFile(); Q_INVOKABLE void open(); signals: void fileModeChanged(); void titleChanged(); void nameFiltersChanged(); void fileSelected(const QString &file); void filterSelected(const QString &filter); void accepted(); void rejected(); private: FileDialog::FileMode m_fileMode {FileDialog::OpenFile}; std::unique_ptr<QFileDialog> m_fileDialog; }; #endif // FILEDIALOG_H
2,006
C++
.h
54
33.574074
103
0.757202
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,320
qmlapplication.h
mltframework_shotcut/src/qmltypes/qmlapplication.h
/* * Copyright (c) 2014-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef QMLAPPLICATION_H #define QMLAPPLICATION_H #include <QObject> #include <QDir> #include <QPoint> #include <QColor> #include <QRect> namespace Mlt { class Producer; } class QmlApplication : public QObject { Q_OBJECT Q_PROPERTY(Qt::WindowModality dialogModality READ dialogModality CONSTANT); Q_PROPERTY(QPoint mousePos READ mousePos); Q_PROPERTY(QColor toolTipBaseColor READ toolTipBaseColor NOTIFY paletteChanged) Q_PROPERTY(QColor toolTipTextColor READ toolTipTextColor NOTIFY paletteChanged) Q_PROPERTY(QString OS READ OS CONSTANT) Q_PROPERTY(QRect mainWinRect READ mainWinRect); Q_PROPERTY(bool hasFiltersOnClipboard READ hasFiltersOnClipboard NOTIFY filtersCopied) Q_PROPERTY(qreal devicePixelRatio READ devicePixelRatio CONSTANT) Q_PROPERTY(int maxTextureSize READ maxTextureSize CONSTANT) Q_PROPERTY(QStringList wipes READ wipes CONSTANT) public: static QmlApplication &singleton(); static Qt::WindowModality dialogModality(); static QPoint mousePos(); static QColor toolTipBaseColor(); static QColor toolTipTextColor(); static QString OS(); static QRect mainWinRect(); static bool hasFiltersOnClipboard(); Q_INVOKABLE static void copyFilters(); Q_INVOKABLE static void pasteFilters(); Q_INVOKABLE static QString clockFromFrames(int frames); Q_INVOKABLE static QString timeFromFrames(int frames); Q_INVOKABLE static int audioChannels(); Q_INVOKABLE static QString getNextProjectFile(const QString &filename); Q_INVOKABLE static bool isProjectFolder(); static qreal devicePixelRatio(); Q_INVOKABLE void showStatusMessage(const QString &message, int timeoutSeconds = 15); static int maxTextureSize(); Q_INVOKABLE static bool confirmOutputFilter(); static QDir dataDir(); Q_INVOKABLE static QColor contrastingColor(QString color); static QStringList wipes(); Q_INVOKABLE static bool addWipe(const QString &filePath); Q_INVOKABLE static bool intersects(const QRectF &a, const QRectF &b); signals: void paletteChanged(); void filtersCopied(); void filtersPasted(Mlt::Producer *); private: explicit QmlApplication(); QmlApplication(QmlApplication const &); void operator=(QmlApplication const &); }; #endif // QMLAPPLICATION_H
3,003
C++
.h
74
37.054054
90
0.773365
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,321
qmlmarkermenu.h
mltframework_shotcut/src/qmltypes/qmlmarkermenu.h
/* * Copyright (c) 2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef QMLMARKERMENU_H #define QMLMARKERMENU_H #include <QObject> class TimelineDock; class QmlMarkerMenu : public QObject { Q_OBJECT Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged) Q_PROPERTY(int index READ index WRITE setIndex NOTIFY indexChanged) public: explicit QmlMarkerMenu(QObject *parent = 0); QObject *target(); void setTarget(QObject *timeline); int index(); void setIndex(int index); signals: void targetChanged(); void indexChanged(); public slots: void popup(); private: TimelineDock *m_timeline; int m_index; }; #endif // QMLMARKERMENU_H
1,338
C++
.h
41
29.756098
80
0.752914
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,322
qmlproducer.h
mltframework_shotcut/src/qmltypes/qmlproducer.h
/* * Copyright (c) 2016-2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef QMLPRODUCER_H #define QMLPRODUCER_H #include <QObject> #include <QString> #include <QVariant> #include <QRectF> #include <MltProducer.h> #include "shotcut_mlt_properties.h" class QmlProducer : public QObject { Q_OBJECT Q_PROPERTY(int in READ in() NOTIFY inChanged) Q_PROPERTY(int out READ out() NOTIFY outChanged) Q_PROPERTY(int aspectRatio READ aspectRatio() NOTIFY producerChanged) Q_PROPERTY(int duration READ duration() NOTIFY durationChanged) Q_PROPERTY(int length READ length() NOTIFY lengthChanged) Q_PROPERTY(QString resource READ resource() NOTIFY producerChanged) Q_PROPERTY(QString mlt_service READ mlt_service() NOTIFY producerChanged) Q_PROPERTY(QString hash READ hash() NOTIFY producerChanged) Q_PROPERTY(QString name READ name() NOTIFY producerChanged) Q_PROPERTY(QVariant audioLevels READ audioLevels NOTIFY audioLevelsChanged) Q_PROPERTY(int fadeIn READ fadeIn NOTIFY producerChanged) Q_PROPERTY(int fadeOut READ fadeOut NOTIFY producerChanged) Q_PROPERTY(double speed READ speed NOTIFY producerChanged) Q_PROPERTY(int position READ position WRITE setPosition NOTIFY positionChanged) Q_PROPERTY(double displayAspectRatio READ displayAspectRatio NOTIFY producerChanged) public: explicit QmlProducer(QObject *parent = 0); int in(); int out(); double aspectRatio(); int duration() { return m_producer.is_valid() ? out() - in() + 1 : 0; } int length() { return m_producer.is_valid() ? m_producer.get_length() : 0; } QString resource(); QString mlt_service() { return m_producer.is_valid() ? m_producer.get("mlt_service") : QString(); } QString hash() { return m_producer.is_valid() ? m_producer.get(kShotcutHashProperty) : QString(); } QString name(); QVariant audioLevels(); int fadeIn(); int fadeOut(); double speed(); int position() const { return m_position; } void setPosition(int position); void seek(int position); Mlt::Producer &producer() { return m_producer; } Q_INVOKABLE void audioLevelsReady(const QPersistentModelIndex &index); Q_INVOKABLE void remakeAudioLevels(); double displayAspectRatio(); Q_INVOKABLE QString get(QString name, int position = -1); Q_INVOKABLE double getDouble(QString name, int position = -1); Q_INVOKABLE QRectF getRect(QString name, int position = -1); Q_INVOKABLE bool outOfBounds(); Q_INVOKABLE void newGlaxnimateFile(const QString &filename); Q_INVOKABLE void launchGlaxnimate(const QString &filename = QString()) const; signals: void producerChanged(); void positionChanged(int position); void seeked(int position); void inChanged(int delta); void outChanged(int delta); void audioLevelsChanged(); void durationChanged(); void lengthChanged(); public slots: void setProducer(Mlt::Producer &producer); void remakeAudioLevels(bool isKeyframesVisible); private: Mlt::Producer m_producer; int m_position; }; #endif // QMLPRODUCER_H
3,815
C++
.h
105
32.085714
88
0.728649
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,324
qmlprofile.h
mltframework_shotcut/src/qmltypes/qmlprofile.h
/* * Copyright (c) 2014-2018 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef PROFILE_H #define PROFILE_H #include <QObject> class QmlProfile : public QObject { Q_OBJECT Q_PROPERTY(int width READ width CONSTANT) Q_PROPERTY(int height READ height CONSTANT) Q_PROPERTY(double aspectRatio READ aspectRatio CONSTANT) Q_PROPERTY(double fps READ fps CONSTANT) Q_PROPERTY(double sar READ sar CONSTANT) public: static QmlProfile &singleton(); int width() const; int height() const; double aspectRatio() const; double fps() const; double sar() const; signals: void profileChanged(); private: explicit QmlProfile(); QmlProfile(QmlProfile const &); void operator=(QmlProfile const &); }; #endif // PROFILE_H
1,397
C++
.h
42
30.190476
72
0.743133
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,325
qmlfilter.h
mltframework_shotcut/src/qmltypes/qmlfilter.h
/* * Copyright (c) 2013-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef FILTER_H #define FILTER_H #include <QObject> #include <QString> #include <QVariant> #include <QRectF> #include <QUuid> #include <QColor> #include <MltService.h> #include <MltProducer.h> #include <MltAnimation.h> #include "qmlmetadata.h" #include "shotcut_mlt_properties.h" class AbstractJob; class EncodeJob; class QUndoCommand; class FilterController; class QmlFilter : public QObject { Q_OBJECT Q_PROPERTY(bool isNew READ isNew CONSTANT) Q_PROPERTY(QString path READ path CONSTANT) Q_PROPERTY(QStringList presets READ presets NOTIFY presetsChanged) Q_PROPERTY(int in READ in NOTIFY inChanged) Q_PROPERTY(int out READ out NOTIFY outChanged) Q_PROPERTY(int animateIn READ animateIn WRITE setAnimateIn NOTIFY animateInChanged) Q_PROPERTY(int animateOut READ animateOut WRITE setAnimateOut NOTIFY animateOutChanged) Q_PROPERTY(int duration READ duration NOTIFY durationChanged) Q_PROPERTY(bool blockSignals READ signalsBlocked WRITE blockSignals) public: enum CurrentFilterIndex { NoCurrentFilter = -1, DeselectCurrentFilter = -2 }; Q_ENUM(CurrentFilterIndex) explicit QmlFilter(); explicit QmlFilter(Mlt::Service &mltService, const QmlMetadata *metadata, QObject *parent = nullptr); ~QmlFilter(); bool isNew() const { return m_isNew; } void setIsNew(bool isNew) { m_isNew = isNew; } Q_INVOKABLE QString get(QString name, int position = -1); Q_INVOKABLE QColor getColor(QString name, int position = -1); Q_INVOKABLE double getDouble(QString name, int position = -1); Q_INVOKABLE QRectF getRect(QString name, int position = -1); Q_INVOKABLE void removeRectPercents(QString name); Q_INVOKABLE QStringList getGradient(QString name); Q_INVOKABLE void set(QString name, QString value, int position = -1); Q_INVOKABLE void set(QString name, const QColor &value, int position = -1, mlt_keyframe_type keyframeType = mlt_keyframe_type(-1)); Q_INVOKABLE void set(QString name, double value, int position = -1, mlt_keyframe_type keyframeType = mlt_keyframe_type(-1)); Q_INVOKABLE void set(QString name, int value, int position = -1, mlt_keyframe_type keyframeType = mlt_keyframe_type(-1)); Q_INVOKABLE void set(QString name, bool value, int position = -1, mlt_keyframe_type keyframeType = mlt_keyframe_type(-1)); Q_INVOKABLE void set(QString name, double x, double y, double width, double height, double opacity = 1.0, int position = -1, mlt_keyframe_type keyframeType = mlt_keyframe_type(-1)); Q_INVOKABLE void set(QString name, const QRectF &rect, int position = -1, mlt_keyframe_type keyframeType = mlt_keyframe_type(-1)); Q_INVOKABLE void setGradient(QString name, const QStringList &gradient); QString path() const { return m_path; } Q_INVOKABLE void loadPresets(); QStringList presets() const { return m_presets; } /// returns the index of the new preset Q_INVOKABLE int savePreset(const QStringList &propertyNames, const QString &name = QString()); Q_INVOKABLE void deletePreset(const QString &name); Q_INVOKABLE void analyze(bool isAudio = false, bool deferJob = true); Q_INVOKABLE static int framesFromTime(const QString &time); Q_INVOKABLE void getHash(); Mlt::Producer &producer() { return m_producer; } int in(); int out(); Mlt::Service &service() { return m_service; } int animateIn(); void setAnimateIn(int value); int animateOut(); void setAnimateOut(int value); void clearAnimateInOut(); int duration(); Q_INVOKABLE void resetProperty(const QString &name); Q_INVOKABLE void clearSimpleAnimation(const QString &name); Mlt::Animation getAnimation(const QString &name); Q_INVOKABLE int keyframeCount(const QString &name); mlt_keyframe_type getKeyframeType(Mlt::Animation &animation, int position, mlt_keyframe_type defaultType); Q_INVOKABLE int getNextKeyframePosition(const QString &name, int position); Q_INVOKABLE int getPrevKeyframePosition(const QString &name, int position); Q_INVOKABLE bool isAtLeastVersion(const QString &version); Q_INVOKABLE static void deselect(); bool allowTrim() const; bool allowAnimateIn() const; bool allowAnimateOut() const; Q_INVOKABLE void crop(const QRectF &rect); QString objectNameOrService(); Q_INVOKABLE void copyParameters(); Q_INVOKABLE void pasteParameters(const QStringList &propertyNames); // Functions for undo/redo void startUndoTracking(); Q_INVOKABLE void startUndoParameterCommand(const QString &desc = QString()); void startUndoAddKeyframeCommand(); void startUndoRemoveKeyframeCommand(); void startUndoModifyKeyframeCommand(int paramIndex, int keyframeIndex); void updateUndoCommand(const QString &name); Q_INVOKABLE void endUndoCommand(); public slots: void preset(const QString &name); signals: void presetsChanged(); void analyzeFinished(bool isSuccess); void changed(QString name = QString()); void inChanged(int delta); void outChanged(int delta); void animateInChanged(); void animateOutChanged(); void animateInOutChanged(); void durationChanged(); void propertyChanged(QString name); // Use to let QML know when a specific property has changed private: const QmlMetadata *m_metadata; Mlt::Service m_service; Mlt::Producer m_producer; QString m_path; bool m_isNew; QStringList m_presets; Mlt::Properties m_previousState; int m_changeInProgress; int keyframeIndex(Mlt::Animation &animation, int position); }; class AnalyzeDelegate : public QObject { Q_OBJECT public: explicit AnalyzeDelegate(Mlt::Filter &filter); public slots: void onAnalyzeFinished(AbstractJob *job, bool isSuccess); private: QString resultsFromXml(const QString &fileName); void updateFilter(Mlt::Filter &filter, const QString &results); void updateJob(EncodeJob *job, const QString &results); QUuid m_uuid; }; #endif // FILTER_H
7,042
C++
.h
178
34.117978
100
0.714348
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,326
colordialog.h
mltframework_shotcut/src/qmltypes/colordialog.h
/* * Copyright (c) 2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef COLORDIALOG_H #define COLORDIALOG_H #include <QColor> #include <QObject> class ColorDialog : public QObject { Q_OBJECT Q_PROPERTY(QColor selectedColor READ selectedColor WRITE setSelectedColor NOTIFY selectedColorChanged) Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged) public: explicit ColorDialog(QObject *parent = nullptr); Q_INVOKABLE void open(); signals: void selectedColorChanged(const QColor &color); void accepted(); void titleChanged(); private: QColor m_color; QString m_title; QColor selectedColor() const { return m_color; } void setSelectedColor(const QColor &color); QString title() const { return m_title; } void setTitle(const QString &title); }; #endif // COLORDIALOG_H
1,582
C++
.h
48
28.125
85
0.713061
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,328
messagedialog.h
mltframework_shotcut/src/qmltypes/messagedialog.h
/* * Copyright (c) 2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MESSAGEDIALOG_H #define MESSAGEDIALOG_H #include <QMessageBox> class MessageDialog : public QObject { Q_OBJECT Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged) Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) Q_PROPERTY(int buttons READ buttons WRITE setButtons NOTIFY buttonsChanged) public: enum StandardButtons { Ok = QMessageBox::Ok, Yes = QMessageBox::Yes, No = QMessageBox::No, Cancel = QMessageBox::Cancel }; Q_ENUM(StandardButtons) explicit MessageDialog(QObject *parent = nullptr); Q_INVOKABLE void open(); signals: void titleChanged(const QString &title); void textChanged(const QString &text); void buttonsChanged(int buttons); void accepted(); void rejected(); private: QString m_title; QString m_text; int m_buttons; QString title() const { return m_title; } void setTitle(const QString &title); QString text() const { return m_text; } void setText(const QString &text); int buttons() const { return m_buttons; } void setButtons(int buttons); }; #endif // MESSAGEDIALOG_H
2,037
C++
.h
62
27.580645
80
0.671261
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,329
qmlfile.h
mltframework_shotcut/src/qmltypes/qmlfile.h
/* * Copyright (c) 2014-2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef QMLFILE_H #define QMLFILE_H #include <QObject> #include <QUrl> #include <QFileSystemWatcher> #include <memory> class QmlFile : public QObject { Q_OBJECT Q_PROPERTY(QString url READ getUrl WRITE setUrl NOTIFY urlChanged) Q_PROPERTY(QString fileName READ getFileName) Q_PROPERTY(QString path READ getPath) Q_PROPERTY(QString filePath READ getFilePath) public: explicit QmlFile(QObject *parent = 0); QString getUrl(); void setUrl(QString text); QString getFileName(); QString getPath(); QString getFilePath(); Q_INVOKABLE void copyFromFile(QString source); Q_INVOKABLE bool exists(); Q_INVOKABLE QString suffix(); public slots: void watch(); signals: void urlChanged(const QUrl &url); void fileChanged(const QString &path); private: QUrl m_url; std::unique_ptr<QFileSystemWatcher> m_watcher; }; #endif // QMLFILE_H
1,602
C++
.h
49
29.673469
72
0.747573
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,330
timelineitems.h
mltframework_shotcut/src/qmltypes/timelineitems.h
/* * Copyright (c) 2015-2016 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _TIMELINEITEMS_H #define _TIMELINEITEMS_H void registerTimelineItems(); #endif
788
C++
.h
20
37.5
72
0.766013
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,331
colorpickeritem.h
mltframework_shotcut/src/qmltypes/colorpickeritem.h
/* * Copyright (c) 2014-2019 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef COLORPICKERITEM_H #define COLORPICKERITEM_H #include "widgets/screenselector.h" #include <QColor> #include <QObject> class ColorPickerItem : public QObject { Q_OBJECT public: explicit ColorPickerItem(QObject *parent = 0); signals: void pickColor(); void colorPicked(const QColor &color); void cancelled(); private slots: void screenSelected(const QRect &rect); void grabColor(); private: ScreenSelector m_selector; QRect m_selectedRect; }; #endif // COLORPICKERITEM_H
1,218
C++
.h
38
29.5
72
0.758532
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,332
qmlrichtextmenu.h
mltframework_shotcut/src/qmltypes/qmlrichtextmenu.h
/* * Copyright (c) 2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef QMLRICHTEXTMENU_H #define QMLRICHTEXTMENU_H #include <QObject> class QmlRichTextMenu : public QObject { Q_OBJECT public: explicit QmlRichTextMenu(QObject *parent = 0); signals: void openTriggered(); void saveAsTriggered(); void undoTriggered(); void redoTriggered(); void cutTriggered(); void copyTriggered(); void pasteTriggered(); void pastePlainTriggered(); void selectAllTriggered(); void insertTableTriggered(); public slots: void popup(); }; #endif // QMLRICHTEXTMENU_H
1,236
C++
.h
39
28.794872
72
0.748739
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,333
fontdialog.h
mltframework_shotcut/src/qmltypes/fontdialog.h
/* * Copyright (c) 2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef FONTDIALOG_H #define FONTDIALOG_H #include <QObject> #include <QFont> class FontDialog : public QObject { Q_OBJECT Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont NOTIFY selectedFontChanged) public: FontDialog(QObject *parent = nullptr); Q_INVOKABLE void open(); signals: void accepted(); void rejected(); void selectedFontChanged(const QFont &font); private: QFont m_font; QFont selectedFont() const { return m_font; } void setSelectedFont(const QFont &font); }; #endif // FONTDIALOG_H
1,324
C++
.h
40
28.875
102
0.722749
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,334
qmlmetadata.h
mltframework_shotcut/src/qmltypes/qmlmetadata.h
/* * Copyright (c) 2013-2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef QMLMETADATA_H #define QMLMETADATA_H #include <QObject> #include <QString> #include <QDir> #include <QUrl> #include <QQmlListProperty> class QmlKeyframesParameter : public QObject { Q_OBJECT Q_PROPERTY(RangeType rangeType MEMBER m_rangeType NOTIFY changed) Q_PROPERTY(QString name MEMBER m_name NOTIFY changed) Q_PROPERTY(QString property MEMBER m_property NOTIFY changed) Q_PROPERTY(QStringList gangedProperties MEMBER m_gangedProperties NOTIFY changed) Q_PROPERTY(bool isCurve MEMBER m_isCurve NOTIFY changed) Q_PROPERTY(double minimum MEMBER m_minimum NOTIFY changed) Q_PROPERTY(double maximum MEMBER m_maximum NOTIFY changed) Q_PROPERTY(QString units MEMBER m_units NOTIFY changed) Q_PROPERTY(bool isRectangle MEMBER m_isRectangle NOTIFY changed) Q_PROPERTY(bool isColor MEMBER m_isColor NOTIFY changed) public: enum RangeType { MinMax, ClipLength, }; Q_ENUM(RangeType) explicit QmlKeyframesParameter(QObject *parent = 0); QString name() const { return m_name; } QString property() const { return m_property; } QStringList gangedProperties() const { return m_gangedProperties; } bool isCurve() const { return m_isCurve; } double minimum() const { return m_minimum; } double maximum() const { return m_maximum; } QString units() const { return m_units; } bool isRectangle() const { return m_isRectangle; } RangeType rangeType() const { return m_rangeType; } bool isColor() const { return m_isColor; } signals: void changed(); private: QString m_name; QString m_property; QStringList m_gangedProperties; bool m_isCurve; double m_minimum; double m_maximum; QString m_units; bool m_isRectangle; RangeType m_rangeType; bool m_isColor; }; class QmlKeyframesMetadata : public QObject { Q_OBJECT Q_PROPERTY(bool allowTrim MEMBER m_allowTrim NOTIFY changed) Q_PROPERTY(bool allowAnimateIn MEMBER m_allowAnimateIn NOTIFY changed) Q_PROPERTY(bool allowAnimateOut MEMBER m_allowAnimateOut NOTIFY changed) Q_PROPERTY(QQmlListProperty<QmlKeyframesParameter> parameters READ parameters NOTIFY changed) /// simpleProperties identifies a list of properties whose keyframe position must be updated when trimming. Q_PROPERTY(QList<QString> simpleProperties MEMBER m_simpleProperties NOTIFY changed) Q_PROPERTY(QString minimumVersion MEMBER m_minimumVersion NOTIFY changed) Q_PROPERTY(bool enabled MEMBER m_enabled NOTIFY changed) Q_PROPERTY(bool allowOvershoot MEMBER m_allowOvershoot NOTIFY changed) public: explicit QmlKeyframesMetadata(QObject *parent = 0); bool allowTrim() const { return m_allowTrim; } bool allowAnimateIn() const { return m_allowAnimateIn; } bool allowAnimateOut() const { return m_allowAnimateOut; } QList<QString> simpleProperties() const { return m_simpleProperties; } bool allowOvershoot() const { return m_allowOvershoot; } QQmlListProperty<QmlKeyframesParameter> parameters() { return QQmlListProperty<QmlKeyframesParameter>(this, &m_parameters); } int parameterCount() const { return m_parameters.count(); } QmlKeyframesParameter *parameter(int index) const { return m_parameters[index]; } Q_INVOKABLE QmlKeyframesParameter *parameter(const QString &propertyName) const; void checkVersion(const QString &version); void setDisabled(); signals: void changed(); private: bool m_allowTrim; bool m_allowAnimateIn; bool m_allowAnimateOut; QList<QmlKeyframesParameter *> m_parameters; QList<QString> m_simpleProperties; QString m_minimumVersion; bool m_enabled; bool m_allowOvershoot; }; class QmlMetadata : public QObject { Q_OBJECT Q_PROPERTY(PluginType type READ type WRITE setType NOTIFY changed) Q_PROPERTY(QString name READ name WRITE setName NOTIFY changed) Q_PROPERTY(QString mlt_service READ mlt_service WRITE set_mlt_service NOTIFY changed) Q_PROPERTY(bool needsGPU READ needsGPU WRITE setNeedsGPU NOTIFY changed) Q_PROPERTY(QString qml READ qmlFileName WRITE setQmlFileName NOTIFY changed) Q_PROPERTY(QString vui READ vuiFileName WRITE setVuiFileName NOTIFY changed) Q_PROPERTY(QUrl qmlFilePath READ qmlFilePath NOTIFY changed) Q_PROPERTY(QUrl vuiFilePath READ vuiFilePath NOTIFY changed) Q_PROPERTY(bool isAudio READ isAudio WRITE setIsAudio NOTIFY changed) Q_PROPERTY(bool isHidden READ isHidden WRITE setIsHidden NOTIFY changed) Q_PROPERTY(bool isFavorite READ isFavorite WRITE setIsFavorite NOTIFY changed) Q_PROPERTY(QString gpuAlt READ gpuAlt WRITE setGpuAlt NOTIFY changed) Q_PROPERTY(bool allowMultiple READ allowMultiple WRITE setAllowMultiple NOTIFY changed) Q_PROPERTY(bool isClipOnly READ isClipOnly WRITE setIsClipOnly NOTIFY changed) Q_PROPERTY(bool isTrackOnly READ isTrackOnly WRITE setIsTrackOnly NOTIFY changed) Q_PROPERTY(bool isOutputOnly READ isOutputOnly WRITE setIsOutputOnly NOTIFY changed) Q_PROPERTY(bool isGpuCompatible READ isGpuCompatible() WRITE setIsGpuCompatible NOTIFY changed) Q_PROPERTY(QmlKeyframesMetadata *keyframes READ keyframes NOTIFY changed) Q_PROPERTY(bool isDeprecated READ isDeprecated WRITE setIsDeprecated NOTIFY changed) Q_PROPERTY(QString minimumVersion MEMBER m_minimumVersion NOTIFY changed) Q_PROPERTY(QString keywords MEMBER m_keywords NOTIFY changed) Q_PROPERTY(QString icon READ iconFilePath WRITE setIconFileName NOTIFY changed) Q_PROPERTY(bool seekReverse MEMBER m_seekReverse NOTIFY changed) public: enum PluginType { Filter, Producer, Transition, Link, FilterSet, }; Q_ENUM(PluginType) unsigned filterMask; explicit QmlMetadata(QObject *parent = 0); void loadSettings(); PluginType type() const { return m_type; } void setType(PluginType); QString name() const { return m_name; } void setName(const QString &); QString mlt_service() const { return m_mlt_service; } void set_mlt_service(const QString &); QString uniqueId() const; bool needsGPU() const { return m_needsGPU; } void setNeedsGPU(bool); QString qmlFileName() const { return m_qmlFileName; } void setQmlFileName(const QString &); QString vuiFileName() const { return m_vuiFileName; } void setVuiFileName(const QString &); QDir path() const { return m_path; } void setPath(const QDir &path); QUrl qmlFilePath() const; QUrl vuiFilePath() const; QString iconFilePath() const { return (m_icon.isEmpty() || m_icon.startsWith("qrc:")) ? m_icon : QUrl::fromLocalFile(m_path.absoluteFilePath(m_icon)).toString(); } void setIconFileName(const QString &); bool isAudio() const { return m_isAudio; } void setIsAudio(bool isAudio); bool isHidden() const { return m_isHidden; } void setIsHidden(bool isHidden); bool isFavorite() const { return m_isFavorite; } void setIsFavorite(bool isFavorite); QString gpuAlt() const { return m_gpuAlt; } void setGpuAlt(const QString &); bool allowMultiple() const { return m_allowMultiple; } void setAllowMultiple(bool allowMultiple); bool isClipOnly() const { return m_isClipOnly; } void setIsClipOnly(bool isClipOnly); bool isTrackOnly() const { return m_isTrackOnly; } void setIsTrackOnly(bool isTrackOnly); bool isOutputOnly() const { return m_isOutputOnly; } void setIsOutputOnly(bool isOutputOnly); bool isGpuCompatible() const { return m_isGpuCompatible; } void setIsGpuCompatible(bool isCompatible) { m_isGpuCompatible = isCompatible; } QmlKeyframesMetadata *keyframes() { return &m_keyframes; } const QmlKeyframesMetadata *keyframes() const { return &m_keyframes; } bool isDeprecated() const { return m_isDeprecated; } void setIsDeprecated(bool deprecated) { m_isDeprecated = deprecated; } bool isMltVersion(const QString &version); QString keywords() const { return m_keywords; } bool seekReverse() const { return m_seekReverse; } signals: void changed(); private: PluginType m_type; QString m_name; QString m_mlt_service; bool m_needsGPU; QString m_qmlFileName; QString m_vuiFileName; QDir m_path; bool m_isAudio; bool m_isHidden; bool m_isFavorite; QString m_gpuAlt; bool m_allowMultiple; bool m_isClipOnly; bool m_isTrackOnly; bool m_isOutputOnly; bool m_isGpuCompatible; QmlKeyframesMetadata m_keyframes; bool m_isDeprecated; QString m_minimumVersion; QString m_keywords; QString m_icon; bool m_seekReverse; }; #endif // QMLMETADATA_H
10,037
C++
.h
340
24.302941
111
0.709001
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,337
qmlview.h
mltframework_shotcut/src/qmltypes/qmlview.h
/* * Copyright (c) 2014-2021 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef QMLVIEW_H #define QMLVIEW_H #include <QObject> #include <QPoint> class QWidget; class QmlView : public QObject { Q_OBJECT public: explicit QmlView(QWidget *qview); Q_INVOKABLE QPoint pos(); private: QWidget *m_qview; }; #endif // QMLVIEW_H
969
C++
.h
31
29.032258
72
0.75188
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,338
qmleditmenu.h
mltframework_shotcut/src/qmltypes/qmleditmenu.h
/* * Copyright (c) 2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef QMLEDITMENU_H #define QMLEDITMENU_H #include <QObject> class QmlEditMenu : public QObject { Q_OBJECT Q_PROPERTY(bool showPastePlain MEMBER m_showPastePlain NOTIFY showPastePlainChanged) Q_PROPERTY(bool readOnly MEMBER m_readOnly NOTIFY readOnlyChanged) public: explicit QmlEditMenu(QObject *parent = 0); signals: void showPastePlainChanged(); void readOnlyChanged(); void undoTriggered(); void redoTriggered(); void cutTriggered(); void copyTriggered(); void pasteTriggered(); void pastePlainTriggered(); void deleteTriggered(); void clearTriggered(); void selectAllTriggered(); public slots: void popup(); private: bool m_showPastePlain; bool m_readOnly; }; #endif // QMLEDITMENU_H
1,465
C++
.h
45
29.422222
88
0.753366
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,341
spatialmedia.h
mltframework_shotcut/src/spatialmedia/spatialmedia.h
/***************************************************************************** * * Copyright 2016 Varol Okan. All rights reserved. * Copyright (c) 2020 Meltytech, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ****************************************************************************/ #ifndef SPATIALMEDIA_H #define SPATIALMEDIA_H #include <string> class SpatialMedia { private: SpatialMedia() {}; public: static bool injectSpherical(const std::string& inFile, const std::string& outFile); }; #endif // SPATIALMEDIA_H
1,056
C++
.h
29
34.37931
87
0.643836
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,345
addencodepresetdialog.h
mltframework_shotcut/src/dialogs/addencodepresetdialog.h
/* * Copyright (c) 2012 Meltytech, LLC * Author: Dan Dennedy <dan@dennedy.org> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ADDENCODEPRESETDIALOG_H #define ADDENCODEPRESETDIALOG_H #include <QDialog> namespace Ui { class AddEncodePresetDialog; } class AddEncodePresetDialog : public QDialog { Q_OBJECT public: explicit AddEncodePresetDialog(QWidget *parent = 0); ~AddEncodePresetDialog(); void setProperties(const QString &); QString presetName() const; QString properties() const; private: Ui::AddEncodePresetDialog *ui; }; #endif // ADDENCODEPRESETDIALOG_H
1,211
C++
.h
36
31.222222
72
0.767123
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,346
customprofiledialog.h
mltframework_shotcut/src/dialogs/customprofiledialog.h
/* * Copyright (c) 2013-2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef CUSTOMPROFILEDIALOG_H #define CUSTOMPROFILEDIALOG_H #include <QDialog> namespace Ui { class CustomProfileDialog; } class CustomProfileDialog : public QDialog { Q_OBJECT public: explicit CustomProfileDialog(QWidget *parent = 0); ~CustomProfileDialog(); QString profileName() const; private slots: void on_buttonBox_accepted(); void on_widthSpinner_editingFinished(); void on_heightSpinner_editingFinished(); void on_fpsSpinner_editingFinished(); void on_fpsComboBox_textActivated(const QString &arg1); void on_resolutionComboBox_textActivated(const QString &arg1); void on_aspectRatioComboBox_textActivated(const QString &arg1); private: Ui::CustomProfileDialog *ui; double m_fps; }; #endif // CUSTOMPROFILEDIALOG_H
1,487
C++
.h
42
32.47619
72
0.769392
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,347
textviewerdialog.h
mltframework_shotcut/src/dialogs/textviewerdialog.h
/* * Copyright (c) 2012-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TEXTVIEWERDIALOG_H #define TEXTVIEWERDIALOG_H #include <QDialog> class QDialogButtonBox; namespace Ui { class TextViewerDialog; } class TextViewerDialog : public QDialog { Q_OBJECT public: explicit TextViewerDialog(QWidget *parent = 0, bool forMltXml = false); ~TextViewerDialog(); void setText(const QString &s, bool scroll = false); QDialogButtonBox *buttonBox() const; private slots: void on_buttonBox_accepted(); private: Ui::TextViewerDialog *ui; bool m_forMltXml; }; #endif // TEXTVIEWERDIALOG_H
1,249
C++
.h
38
30.394737
75
0.761231
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,348
alignaudiodialog.h
mltframework_shotcut/src/dialogs/alignaudiodialog.h
/* * Copyright (c) 2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ALIGNAUDIODIALOG_H #define ALIGNAUDIODIALOG_H #include "models/alignclipsmodel.h" #include <QDialog> #include <QUuid> class QComboBox; class QDialogButtonBox; class QLabel; class QListWidget; class QLineEdit; class QPushButton; class QTreeView; class AlignTableDelegate; class MultitrackModel; class LongUiTask; class AlignAudioDialog : public QDialog { Q_OBJECT public: explicit AlignAudioDialog(QString title, MultitrackModel *model, const QVector<QUuid> &uuids, QWidget *parent = 0); virtual ~AlignAudioDialog(); private slots: void rebuildClipList(); void process(); void apply(); void processAndApply(); void updateReferenceProgress(int percent); void updateClipProgress(int index, int percent); void clipFinished(int index, int offset, double speed, double quality); private: AlignTableDelegate *m_delegate; MultitrackModel *m_model; AlignClipsModel m_alignClipsModel; QVector<QUuid> m_uuids; QComboBox *m_trackCombo; QComboBox *m_speedCombo; QTreeView *m_table; QDialogButtonBox *m_buttonBox; QPushButton *m_applyButton; QPushButton *m_processAndApplyButton; LongUiTask *m_uiTask; }; #endif // ALIGNAUDIODIALOG_H
1,944
C++
.h
60
29.1
97
0.758933
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,349
bitratedialog.h
mltframework_shotcut/src/dialogs/bitratedialog.h
/* * Copyright (c) 2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef BITRATEDIALOG_H #define BITRATEDIALOG_H #include <QDialog> #include <QString> #include <QJsonArray> class BitrateDialog : public QDialog { Q_OBJECT public: explicit BitrateDialog(const QString &resource, double fps, const QJsonArray &data, QWidget *parent = nullptr); }; #endif // BITRATEDIALOG_H
1,070
C++
.h
29
32.896552
88
0.725073
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,350
unlinkedfilesdialog.h
mltframework_shotcut/src/dialogs/unlinkedfilesdialog.h
/* * Copyright (c) 2016-1029 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef UNLINKEDFILESDIALOG_H #define UNLINKEDFILESDIALOG_H #include <QDialog> #include <QStandardItemModel> #include <QDir> namespace Ui { class UnlinkedFilesDialog; } class UnlinkedFilesDialog : public QDialog { Q_OBJECT public: explicit UnlinkedFilesDialog(QWidget *parent = 0); ~UnlinkedFilesDialog(); void setModel(QStandardItemModel &model); private slots: void on_tableView_doubleClicked(const QModelIndex &index); void on_searchFolderButton_clicked(); private: bool lookInDir(const QDir &dir, bool recurse = false); Ui::UnlinkedFilesDialog *ui; }; #endif // UNLINKEDFILESDIALOG_H
1,329
C++
.h
39
31.589744
72
0.770915
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,351
systemsyncdialog.h
mltframework_shotcut/src/dialogs/systemsyncdialog.h
/* * Copyright (c) 2020 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SYSTEMSYNCDIALOG_H #define SYSTEMSYNCDIALOG_H #include <QDialog> namespace Ui { class SystemSyncDialog; } class SystemSyncDialog : public QDialog { Q_OBJECT public: explicit SystemSyncDialog(QWidget *parent = nullptr); ~SystemSyncDialog(); private slots: void on_syncSlider_sliderReleased(); void on_syncSpinBox_editingFinished(); void on_buttonBox_rejected(); void on_undoButton_clicked(); void on_syncSpinBox_valueChanged(int arg1); void on_applyButton_clicked(); private: Ui::SystemSyncDialog *ui; int m_oldValue; void setDelay(int delay); }; #endif // SYSTEMSYNCDIALOG_H
1,338
C++
.h
41
29.756098
72
0.757599
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,352
durationdialog.h
mltframework_shotcut/src/dialogs/durationdialog.h
/* * Copyright (c) 2012-2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DURATIONDIALOG_H #define DURATIONDIALOG_H #include <QDialog> namespace Ui { class DurationDialog; } class DurationDialog : public QDialog { Q_OBJECT public: explicit DurationDialog(QWidget *parent = 0); ~DurationDialog(); void setDuration(int); int duration() const; private: Ui::DurationDialog *ui; }; #endif // DURATIONDIALOG_H
1,067
C++
.h
34
29.029412
72
0.756335
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,353
multifileexportdialog.h
mltframework_shotcut/src/dialogs/multifileexportdialog.h
/* * Copyright (c) 2021 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MULTIFILEEXPORTDIALOG_H #define MULTIFILEEXPORTDIALOG_H #include <QDialog> #include <QStringList> class QComboBox; class QDialogButtonBox; class QLabel; class QListWidget; class QLineEdit; namespace Mlt { class Playlist; } class MultiFileExportDialog : public QDialog { Q_OBJECT public: explicit MultiFileExportDialog(QString title, Mlt::Playlist *playlist, const QString &directory, const QString &prefix, const QString &extension, QWidget *parent = 0); QStringList getExportFiles(); private slots: void rebuildList(); void browse(); private: QString appendField(QString text, QComboBox *combo, int clipIndex); void fillCombo(QComboBox *combo); Mlt::Playlist *m_playlist; QLineEdit *m_dir; QLineEdit *m_prefix; QComboBox *m_field1; QComboBox *m_field2; QComboBox *m_field3; QLineEdit *m_ext; QLabel *m_errorIcon; QLabel *m_errorText; QListWidget *m_list; QDialogButtonBox *m_buttonBox; QStringList m_stringList; }; #endif // MULTIFILEEXPORTDIALOG_H
1,770
C++
.h
55
28.745455
105
0.744581
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,354
resourcedialog.h
mltframework_shotcut/src/dialogs/resourcedialog.h
/* * Copyright (c) 2023-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef RESOURCEDIALOG_H #define RESOURCEDIALOG_H #include <QDialog> class ResourceWidget; namespace Mlt { class Producer; } class ResourceDialog : public QDialog { Q_OBJECT public: explicit ResourceDialog(QWidget *parent = 0); void search(Mlt::Producer *producer); void add(Mlt::Producer *producer); void selectTroubleClips(); bool hasTroubleClips(); int producerCount(); Mlt::Producer producer(int index); private slots: void convert(); protected: virtual void showEvent(QShowEvent *event) override; private: ResourceWidget *m_resourceWidget; }; #endif // RESOURCEDIALOG_H
1,327
C++
.h
42
28.952381
72
0.758431
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,355
transcodedialog.h
mltframework_shotcut/src/dialogs/transcodedialog.h
/* * Copyright (c) 2017-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TRANSCODEDIALOG_H #define TRANSCODEDIALOG_H #include <QDialog> namespace Ui { class TranscodeDialog; } class TranscodeDialog : public QDialog { Q_OBJECT public: explicit TranscodeDialog(const QString &message, bool isProgressive, QWidget *parent = nullptr); ~TranscodeDialog(); int format() const { return m_format; } void showCheckBox(); bool isCheckBoxChecked() const { return m_isChecked; } bool deinterlace() const; bool fpsOverride() const; double fps() const; QString frc() const; bool get709Convert(); void set709Convert(bool enable); QString sampleRate() const; void showSubClipCheckBox(); bool isSubClip() const; void setSubClipChecked(bool checked); void setFrameRate(double fps); private slots: void on_horizontalSlider_valueChanged(int position); void on_checkBox_clicked(bool checked); void on_advancedCheckBox_clicked(bool checked); private: Ui::TranscodeDialog *ui; int m_format; bool m_isChecked; bool m_isProgressive; }; #endif // TRANSCODEDIALOG_H
1,810
C++
.h
59
27.084746
100
0.735784
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,356
saveimagedialog.h
mltframework_shotcut/src/dialogs/saveimagedialog.h
/* * Copyright (c) 2021 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SAVEIMAGEDIALOG_H #define SAVEIMAGEDIALOG_H #include <QFileDialog> #include <QImage> #include <QString> class SaveImageDialog : public QFileDialog { Q_OBJECT public: explicit SaveImageDialog(QWidget *parent, const QString &caption, QImage &image); QString saveFile() { return m_saveFile; } private slots: void onFilterSelected(const QString &filter); void onFileSelected(const QString &file); private: QImage &m_image; QString m_saveFile; }; #endif // SAVEIMAGEDIALOG_H
1,222
C++
.h
38
29.421053
85
0.753611
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,357
transcribeaudiodialog.h
mltframework_shotcut/src/dialogs/transcribeaudiodialog.h
/* * Copyright (c) 2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TRANSCRIBEAUDIODIALOG_H #define TRANSCRIBEAUDIODIALOG_H #include <QDialog> class QAbstractButton; class QCheckBox; class QComboBox; class QDialogButtonBox; class QLineEdit; class QListWidget; class QSpinBox; class TranscribeAudioDialog : public QDialog { Q_OBJECT public: explicit TranscribeAudioDialog(const QString &trackName, QWidget *parent); QString name(); QString language(); QList<int> tracks(); bool translate(); int maxLineLength(); bool includeNonspoken(); private slots: void clicked(QAbstractButton *button); private: void updateWhisperStatus(); QLineEdit *m_name; QComboBox *m_lang; QCheckBox *m_translate; QSpinBox *m_maxLength; QCheckBox *m_nonspoken; QListWidget *m_trackList; QWidget *m_configWidget; QLineEdit *m_exeLabel; QLineEdit *m_modelLabel; QDialogButtonBox *m_buttonBox; }; #endif // TRANSCRIBEAUDIODIALOG_H
1,624
C++
.h
53
27.698113
78
0.760077
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,358
listselectiondialog.h
mltframework_shotcut/src/dialogs/listselectiondialog.h
/* * Copyright (c) 2018-2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef LISTSELECTIONDIALOG_H #define LISTSELECTIONDIALOG_H #include <QDialog> namespace Ui { class ListSelectionDialog; } class QListWidgetItem; class QDialogButtonBox; class ListSelectionDialog : public QDialog { Q_OBJECT public: explicit ListSelectionDialog(const QStringList &list, QWidget *parent = 0); ~ListSelectionDialog(); void setColors(const QStringList &colors); void setSelection(const QStringList &selection); QStringList selection() const; QDialogButtonBox *buttonBox() const; private: Ui::ListSelectionDialog *ui; private slots: void onItemActivated(QListWidgetItem *item); }; #endif // LISTSELECTIONDIALOG_H
1,367
C++
.h
40
31.7
79
0.776346
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,359
editmarkerdialog.h
mltframework_shotcut/src/dialogs/editmarkerdialog.h
/* * Copyright (c) 2021 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef EDITMARKERDIALOG_H #define EDITMARKERDIALOG_H #include <QDialog> class EditMarkerWidget; class QAbstractButton; class QDialogButtonBox; class EditMarkerDialog : public QDialog { Q_OBJECT public: explicit EditMarkerDialog(QWidget *parent, const QString &text, const QColor &color, int start, int end, int maxEnd); QString getText(); QColor getColor(); int getStart(); int getEnd(); private slots: void clicked(QAbstractButton *button); private: EditMarkerWidget *m_sWidget; QDialogButtonBox *m_buttonBox; }; #endif // EDITMARKERDIALOG_H
1,311
C++
.h
39
30.333333
99
0.746835
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,360
longuitask.h
mltframework_shotcut/src/dialogs/longuitask.h
/* * Copyright (c) 2020 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef LONGUITASK_H #define LONGUITASK_H #include <QFuture> #include <QProgressDialog> #include <QtConcurrent/QtConcurrent> class LongUiTask : public QProgressDialog { public: explicit LongUiTask(QString title); ~LongUiTask(); template <class Ret> Ret wait(QString text, const QFuture<Ret> &future) { setLabelText(text); setRange(0, 0); while (!future.isFinished()) { setValue(0); QCoreApplication::processEvents(); QThread::msleep(100); } return future.result(); } template <class Ret, class Func, class ...Args> Ret runAsync(QString text, Func &&f, Args &&...args) { QFuture<Ret> future = QtConcurrent::run(f, std::forward<Args>(args)...); return wait<Ret>(text, future); } void reportProgress(QString text, int value, int max); static void cancel(); }; #endif // LONGUITASK_H
1,620
C++
.h
48
29.375
80
0.69393
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,361
slideshowgeneratordialog.h
mltframework_shotcut/src/dialogs/slideshowgeneratordialog.h
/* * Copyright (c) 2020 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SLIDESHOWGENERATORDIALOG_H #define SLIDESHOWGENERATORDIALOG_H #include <MltPlaylist.h> #include <QDialog> class SlideshowGeneratorWidget; class QAbstractButton; class QDialogButtonBox; class SlideshowGeneratorDialog : public QDialog { Q_OBJECT public: explicit SlideshowGeneratorDialog(QWidget *parent, Mlt::Playlist &clips); Mlt::Playlist *getSlideshow(); private slots: void clicked(QAbstractButton *button); private: SlideshowGeneratorWidget *m_sWidget; QDialogButtonBox *m_buttonBox; }; #endif // SLIDESHOWGENERATORDIALOG_H
1,262
C++
.h
36
32.722222
77
0.784717
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,362
actionsdialog.h
mltframework_shotcut/src/dialogs/actionsdialog.h
/* * Copyright (c) 2022-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ACTIONSDIALOG_H #define ACTIONSDIALOG_H #include "models/actionsmodel.h" #include <QDialog> class PrivateTreeView; class QLineEdit; class QSortFilterProxyModel; class StatusLabelWidget; class QKeySequenceEdit; class ActionsDialog : public QDialog { Q_OBJECT public: explicit ActionsDialog(QWidget *parent = 0); void saveCurrentEditor(); public slots: void focusSearchResults(); protected: void hideEvent(QHideEvent *event); void showEvent(QShowEvent *event); private: QLineEdit *m_searchField; ActionsModel m_model; PrivateTreeView *m_table; QSortFilterProxyModel *m_proxyModel; StatusLabelWidget *m_status; }; #endif // ACTIONSDIALOG_H
1,396
C++
.h
44
29.181818
72
0.773641
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,363
subtitletrackdialog.h
mltframework_shotcut/src/dialogs/subtitletrackdialog.h
/* * Copyright (c) 2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SUBTITLETRACKDIALOG_H #define SUBTITLETRACKDIALOG_H #include <QDialog> class QLineEdit; class QComboBox; class SubtitleTrackDialog : public QDialog { Q_OBJECT public: explicit SubtitleTrackDialog(const QString &name, const QString &lang, QWidget *parent); QString getName(); QString getLanguage(); private slots: void accept(); private: QLineEdit *m_name; QComboBox *m_lang; }; #endif // SUBTITLETRACKDIALOG_H
1,147
C++
.h
35
30.314286
92
0.762681
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,364
filedatedialog.h
mltframework_shotcut/src/dialogs/filedatedialog.h
/* * Copyright (c) 2019 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef FILEDATEDIALOG_H #define FILEDATEDIALOG_H #include <QDialog> class QComboBox; class QDateTimeEdit; namespace Mlt { class Producer; } class FileDateDialog : public QDialog { Q_OBJECT public: explicit FileDateDialog(QString title, Mlt::Producer *producer, QWidget *parent = 0); private slots: void accept(); void dateSelected(int index); private: void populateDateOptions(Mlt::Producer *producer); Mlt::Producer *m_producer; QComboBox *m_dtCombo; QDateTimeEdit *m_dtEdit; }; #endif // FILEDATEDIALOG_H
1,242
C++
.h
39
29.410256
89
0.761307
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,365
alignmentarray.h
mltframework_shotcut/src/dialogs/alignmentarray.h
/* * Copyright (c) 2022 Meltytech, LLC * * Author: André Caldas de Souza <andrecaldas@unb.br> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ALIGNMENTARRAY_H #define ALIGNMENTARRAY_H #include <QMutex> #include <complex> #include <fftw3.h> #include <vector> class AlignmentArray { public: AlignmentArray(); AlignmentArray(size_t minimum_size); virtual ~AlignmentArray(); void init(size_t minimum_size); void setValues(const std::vector<double> &values); double calculateOffset(AlignmentArray &from, int *offset); double calculateOffsetAndSpeed(AlignmentArray &from, double *speed, int *offset, double speedRange); private: void transform(); std::vector<double> m_values; fftw_plan m_forwardPlan; std::complex<double> *m_forwardBuf; fftw_plan m_backwardPlan; std::complex<double> *m_backwardBuf; double m_autocorrelationMax; size_t m_minimumSize; size_t m_actualComplexSize; bool m_isTransformed; QMutex m_transformMutex; }; #endif
1,628
C++
.h
48
30.895833
104
0.748728
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,366
playlistmodel.h
mltframework_shotcut/src/models/playlistmodel.h
/* * Copyright (c) 2012-2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef PLAYLISTMODEL_H #define PLAYLISTMODEL_H #include <QAbstractTableModel> #include <qmimedata.h> #include <QStringList> #include "MltPlaylist.h" class PlaylistModel : public QAbstractTableModel { Q_OBJECT public: enum ViewMode { Invalid, Detailed, Tiled, Icons, }; enum Columns { COLUMN_INDEX = 0, COLUMN_THUMBNAIL, COLUMN_RESOURCE, COLUMN_IN, COLUMN_DURATION, COLUMN_START, COLUMN_DATE, COLUMN_COUNT }; enum Fields { FIELD_INDEX = Qt::UserRole, FIELD_THUMBNAIL, FIELD_RESOURCE, FIELD_IN, FIELD_DURATION, FIELD_START, FIELD_DATE, }; static const int THUMBNAIL_WIDTH = 80; static const int THUMBNAIL_HEIGHT = 45; explicit PlaylistModel(QObject *parent = 0); ~PlaylistModel(); int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; QVariant headerData(int section, Qt::Orientation orientation, int role) const; Qt::DropActions supportedDropActions() const; bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()); bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild); void sort(int column, Qt::SortOrder order = Qt::AscendingOrder); Qt::ItemFlags flags(const QModelIndex &index) const; QStringList mimeTypes() const; QMimeData *mimeData(const QModelIndexList &indexes) const; bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent); QModelIndex incrementIndex(const QModelIndex &index) const; QModelIndex decrementIndex(const QModelIndex &index) const; QModelIndex createIndex(int row, int column) const; void createIfNeeded(); void showThumbnail(int row); void refreshThumbnails(); Mlt::Playlist *playlist() { return m_playlist; } void setPlaylist(Mlt::Playlist &playlist); void setInOut(int row, int in, int out); ViewMode viewMode() const; void setViewMode(ViewMode mode); signals: void created(); void cleared(); void closed(); void modified(); void loaded(); void dropped(const QMimeData *data, int row); void moveClip(int from, int to); void inChanged(int in); void outChanged(int out); void removing(Mlt::Service *service); public slots: void clear(); void load(); void append(Mlt::Producer &, bool emitModified = true); void insert(Mlt::Producer &, int row); void remove(int row); void update(int row, Mlt::Producer &producer, bool copyFilters = false); void updateThumbnails(int row); void appendBlank(int frames); void insertBlank(int frames, int row); void close(); void move(int from, int to); private: Mlt::Playlist *m_playlist; int m_dropRow; ViewMode m_mode; QList<int> m_rowsRemoved; private slots: void onRowsAboutToBeRemoved(const QModelIndex &parent, int first, int last); }; #endif // PLAYLISTMODEL_H
4,077
C++
.h
116
29.991379
88
0.70147
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,367
alignclipsmodel.h
mltframework_shotcut/src/models/alignclipsmodel.h
/* * Copyright (c) 2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ALIGNCLIPSMODEL_H #define ALIGNCLIPSMODEL_H #include <QAbstractItemModel> #include <limits> class AlignClipsModel : public QAbstractItemModel { Q_OBJECT public: enum Columns { COLUMN_ERROR = 0, COLUMN_NAME, COLUMN_OFFSET, COLUMN_SPEED, COLUMN_COUNT, }; static const int INVALID_OFFSET = std::numeric_limits<int>::max(); explicit AlignClipsModel(QObject *parent = 0); virtual ~AlignClipsModel(); void clear(); void addClip(const QString &name, int offset, int speed, const QString &error); void updateProgress(int row, int percent); int getProgress(int row) const; void updateOffsetAndSpeed(int row, int offset, double speed, const QString &error); int getOffset(int row); double getSpeed(int row); protected: // Implement QAbstractItemModel int rowCount(const QModelIndex &parent) const; int columnCount(const QModelIndex &parent) const; QVariant data(const QModelIndex &index, int role) const; QVariant headerData(int section, Qt::Orientation orientation, int role) const; QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const; QModelIndex parent(const QModelIndex &index) const; private: typedef struct { QString name; int offset; double speed; QString error; int progress; } ClipAlignment; QList<ClipAlignment> m_clips; }; #endif // ALIGNCLIPSMODEL_H
2,175
C++
.h
60
31.966667
96
0.726366
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,368
attachedfiltersmodel.h
mltframework_shotcut/src/models/attachedfiltersmodel.h
/* * Copyright (c) 2013-2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ATTACHEDFILTERSMODEL_H #define ATTACHEDFILTERSMODEL_H #include <QAbstractListModel> #include <MltFilter.h> #include <MltProducer.h> #include <MltEvent.h> class QmlMetadata; class AttachedFiltersModel : public QAbstractListModel { Q_OBJECT Q_PROPERTY(QString producerTitle READ producerTitle NOTIFY trackTitleChanged) Q_PROPERTY(bool isProducerSelected READ isProducerSelected NOTIFY isProducerSelectedChanged) Q_PROPERTY(bool supportsLinks READ supportsLinks NOTIFY supportsLinksChanged) public: enum ModelRoles { TypeDisplayRole = Qt::UserRole + 1, PluginTypeRole, }; explicit AttachedFiltersModel(QObject *parent = 0); Mlt::Service *getService(int row) const; QmlMetadata *getMetadata(int row) const; void setProducer(Mlt::Producer *producer = 0); QString producerTitle() const; bool isProducerSelected() const; bool isSourceClip() const; bool supportsLinks() const; Mlt::Producer *producer() const { return m_producer.data(); } QString name(int row) const; // The below are used by QUndoCommands void doAddService(Mlt::Producer &producer, Mlt::Service &service, int row); void doRemoveService(Mlt::Producer &producer, int row); void doMoveService(Mlt::Producer &producer, int fromRow, int toRow); void doSetDisabled(Mlt::Producer &producer, int row, bool disable); Mlt::Service doGetService(Mlt::Producer &producer, int row); // QAbstractListModel Implementation int rowCount(const QModelIndex &parent = QModelIndex()) const; Qt::ItemFlags flags(const QModelIndex &index) const; QVariant data(const QModelIndex &index, int role) const; bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); QHash<int, QByteArray> roleNames() const; Qt::DropActions supportedDropActions() const; bool insertRows(int row, int count, const QModelIndex &parent); bool removeRows(int row, int count, const QModelIndex &parent); bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationRow); signals: void changed(); void duplicateAddFailed(int index); void trackTitleChanged(); void isProducerSelectedChanged(); void supportsLinksChanged(); void addedOrRemoved(Mlt::Producer *); void requestConvert(QString, bool set709Convert, bool withSubClip); public slots: int add(QmlMetadata *meta); int addService(Mlt::Service *service); void remove(int row); bool move(int fromRow, int toRow); private: static void producerChanged(mlt_properties owner, AttachedFiltersModel *model); void reset(Mlt::Producer *producer = 0); bool isProducerLoaded(Mlt::Producer &producer) const; int findInsertRow(QmlMetadata *meta); Mlt::Producer getFilterSetProducer(QmlMetadata *meta); int m_dropRow; int m_removeRow; QScopedPointer<Mlt::Producer> m_producer; QScopedPointer<Mlt::Event> m_event; typedef QList<QmlMetadata *> MetadataList; MetadataList m_metaList; }; #endif // ATTACHEDFILTERSMODEL_H
3,845
C++
.h
91
38.021978
96
0.750601
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,369
actionsmodel.h
mltframework_shotcut/src/models/actionsmodel.h
/* * Copyright (c) 2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ACTIONSMODEL_H #define ACTIONSMODEL_H #include <QAbstractItemModel> class QAction; class ActionsModel : public QAbstractItemModel { Q_OBJECT public: enum Columns { COLUMN_ACTION = 0, COLUMN_SEQUENCE1, COLUMN_SEQUENCE2, COLUMN_COUNT }; enum { HardKeyRole = Qt::UserRole, DefaultKeyRole, }; explicit ActionsModel(QObject *parent = 0); QAction *action(const QModelIndex &index) const; signals: void editError(const QString &error); protected: // Implement QAbstractItemModel int rowCount(const QModelIndex &parent) const override; int columnCount(const QModelIndex &parent) const override; QVariant data(const QModelIndex &index, int role) const override; bool setData(const QModelIndex &index, const QVariant &value, int role) override; QVariant headerData(int section, Qt::Orientation orientation, int role) const override; QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const override; QModelIndex parent(const QModelIndex &index) const override; Qt::ItemFlags flags(const QModelIndex &index) const override; QHash<int, QByteArray> roleNames() const override; private: QList<QAction *> m_actions; }; #endif // ACTIONSMODEL_H
2,021
C++
.h
54
33.259259
91
0.73582
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,370
multitrackmodel.h
mltframework_shotcut/src/models/multitrackmodel.h
/* * Copyright (c) 2013-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MULTITRACKMODEL_H #define MULTITRACKMODEL_H #include <QAbstractItemModel> #include <QList> #include <QString> #include <MltTractor.h> #include <MltPlaylist.h> #include <memory> typedef enum { PlaylistTrackType = 0, BlackTrackType, SilentTrackType, AudioTrackType, VideoTrackType } TrackType; typedef struct { TrackType type; int number; int mlt_index; } Track; typedef QList<Track> TrackList; class MultitrackModel : public QAbstractItemModel { Q_OBJECT Q_PROPERTY(int trackHeight READ trackHeight WRITE setTrackHeight NOTIFY trackHeightChanged) Q_PROPERTY(double scaleFactor READ scaleFactor WRITE setScaleFactor NOTIFY scaleFactorChanged) Q_PROPERTY(bool filtered READ isFiltered NOTIFY filteredChanged) public: /// Two level model: tracks and clips on track enum { NameRole = Qt::UserRole + 1, CommentRole, /// clip only ResourceRole, /// clip only ServiceRole, /// clip only IsBlankRole, /// clip only StartRole, /// clip only DurationRole, InPointRole, /// clip only OutPointRole, /// clip only FramerateRole, /// clip only IsMuteRole, /// track only IsHiddenRole, /// track only IsAudioRole, AudioLevelsRole, /// clip only IsCompositeRole, /// track only IsLockedRole, /// track only FadeInRole, /// clip only FadeOutRole, /// clip only IsTransitionRole,/// clip only FileHashRole, /// clip only SpeedRole, /// clip only IsFilteredRole, IsTopVideoRole, /// track only IsBottomVideoRole,/// track only IsTopAudioRole, /// track only IsBottomAudioRole,/// track only AudioIndexRole, /// clip only GroupRole, /// clip only }; explicit MultitrackModel(QObject *parent = 0); ~MultitrackModel(); Mlt::Tractor *tractor() const { return m_tractor; } const TrackList &trackList() const { return m_trackList; } int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent) const; QVariant data(const QModelIndex &index, int role) const; QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const; QModelIndex makeIndex(int trackIndex, int clipIndex) const; QModelIndex parent(const QModelIndex &index) const; QHash<int, QByteArray> roleNames() const; Q_INVOKABLE void audioLevelsReady(const QPersistentModelIndex &index); bool createIfNeeded(); void addBackgroundTrack(); int addAudioTrack(); int addVideoTrack(); void removeTrack(int trackIndex); void load(); void close(); int clipIndex(int trackIndex, int position); bool trimClipInValid(int trackIndex, int clipIndex, int delta, bool ripple); bool trimClipOutValid(int trackIndex, int clipIndex, int delta, bool ripple); int trackHeight() const; void setTrackHeight(int height); double scaleFactor() const; void setScaleFactor(double scale); bool isTransition(Mlt::Playlist &playlist, int clipIndex) const; void insertTrack(int trackIndex, TrackType type = VideoTrackType); void moveTrack(int fromTrackIndex, int toTrackIndex); void insertOrAdjustBlankAt(QList<int> tracks, int position, int length); bool mergeClipWithNext(int trackIndex, int clipIndex, bool dryrun); std::unique_ptr<Mlt::ClipInfo> findClipByUuid(const QUuid &uuid, int &trackIndex, int &clipIndex); std::unique_ptr<Mlt::ClipInfo> getClipInfo(int trackIndex, int clipIndex); QString getTrackName(int trackIndex); int bottomVideoTrackIndex() const; int mltIndexForTrack(int trackIndex) const; bool checkForEmptyTracks(int trackIndex); signals: void created(); void aboutToClose(); void closed(); void modified(); void seeked(int position, bool seekPlayer = true); void trackHeightChanged(); void scaleFactorChanged(); void showStatusMessage(QString); void durationChanged(); void filteredChanged(); void reloadRequested(); void appended(int trackIndex, int clipIndex); void inserted(int trackIndex, int clipIndex); void overWritten(int trackIndex, int clipIndex); void removing(Mlt::Service *service); void noMoreEmptyTracks(bool isAudio); public slots: void refreshTrackList(); void setTrackName(int row, const QString &value); void setTrackMute(int row, bool mute); void setTrackHidden(int row, bool hidden); void setTrackComposite(int row, bool composite); void setTrackLock(int row, bool lock); int trimClipIn(int trackIndex, int clipIndex, int delta, bool ripple, bool rippleAllTracks); void notifyClipIn(int trackIndex, int clipIndex); int trimClipOut(int trackIndex, int clipIndex, int delta, bool ripple, bool rippleAllTracks); void notifyClipOut(int trackIndex, int clipIndex); bool moveClip(int fromTrack, int toTrack, int clipIndex, int position, bool ripple, bool rippleAllTracks); int overwriteClip(int trackIndex, Mlt::Producer &clip, int position, bool seek = true); QString overwrite(int trackIndex, Mlt::Producer &clip, int position, bool seek = true, bool notify = true); int insertClip(int trackIndex, Mlt::Producer &clip, int position, bool rippleAllTracks, bool seek = true, bool notify = true); int appendClip(int trackIndex, Mlt::Producer &clip, bool seek = true, bool notify = true); void removeClip(int trackIndex, int clipIndex, bool rippleAllTracks); void liftClip(int trackIndex, int clipIndex); void splitClip(int trackIndex, int clipIndex, int position); void joinClips(int trackIndex, int clipIndex); void fadeIn(int trackIndex, int clipIndex, int duration); void fadeOut(int trackIndex, int clipIndex, int duration); bool addTransitionValid(int fromTrack, int toTrack, int clipIndex, int position, bool ripple); int addTransition(int trackIndex, int clipIndex, int position, bool ripple, bool rippleAllTracks); void removeTransition(int trackIndex, int clipIndex); void removeTransitionByTrimIn(int trackIndex, int clipIndex, int delta); void removeTransitionByTrimOut(int trackIndex, int clipIndex, int delta); bool trimTransitionInValid(int trackIndex, int clipIndex, int delta); void trimTransitionIn(int trackIndex, int clipIndex, int delta, bool slip = false); bool trimTransitionOutValid(int trackIndex, int clipIndex, int delta); void trimTransitionOut(int trackIndex, int clipIndex, int delta, bool slip = false); bool addTransitionByTrimInValid(int trackIndex, int clipIndex, int delta); int addTransitionByTrimIn(int trackIndex, int clipIndex, int delta); bool addTransitionByTrimOutValid(int trackIndex, int clipIndex, int delta); void addTransitionByTrimOut(int trackIndex, int clipIndex, int delta); bool removeTransitionByTrimInValid(int trackIndex, int clipIndex, int delta); bool removeTransitionByTrimOutValid(int trackIndex, int clipIndex, int delta); void filterAddedOrRemoved(Mlt::Producer *producer); void onFilterChanged(Mlt::Service *service); void reload(bool asynchronous = false); void replace(int trackIndex, int clipIndex, Mlt::Producer &clip, bool copyFilters = true); private: Mlt::Tractor *m_tractor; TrackList m_trackList; bool m_isMakingTransition; void moveClipToEnd(Mlt::Playlist &playlist, int trackIndex, int clipIndex, int position, bool ripple, bool rippleAllTracks); void moveClipInBlank(Mlt::Playlist &playlist, int trackIndex, int clipIndex, int position, bool ripple, bool rippleAllTracks, int duration = 0); void consolidateBlanks(Mlt::Playlist &playlist, int trackIndex); void consolidateBlanksAllTracks(); void getAudioLevels(); void addBlackTrackIfNeeded(); void convertOldDoc(); Mlt::Transition *getTransition(const QString &name, int trackIndex) const; Mlt::Filter *getFilter(const QString &name, int trackIndex) const; Mlt::Filter *getFilter(const QString &name, Mlt::Service *service) const; void removeBlankPlaceholder(Mlt::Playlist &playlist, int trackIndex); void retainPlaylist(); void loadPlaylist(); void removeRegion(int trackIndex, int position, int length); void clearMixReferences(int trackIndex, int clipIndex); bool isFiltered(Mlt::Producer *producer = 0) const; int getDuration(); void adjustServiceFilterDurations(Mlt::Service &service, int duration); bool warnIfInvalid(Mlt::Service &service); Mlt::Transition *getVideoBlendTransition(int trackIndex) const; void refreshVideoBlendTransitions(); int bottomVideoTrackMltIndex() const; bool hasEmptyTrack(TrackType trackType) const; friend class UndoHelper; private slots: void adjustBackgroundDuration(); void adjustTrackFilters(); }; #endif // MULTITRACKMODEL_H
9,831
C++
.h
215
40.237209
102
0.726013
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,371
subtitlesmodel.h
mltframework_shotcut/src/models/subtitlesmodel.h
/* * Copyright (c) 2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SUBTITLESMODEL_H #define SUBTITLESMODEL_H #include <MltProducer.h> #include "models/subtitles.h" #include <QAbstractItemModel> #include <QTimer> #include <QString> #include <vector> class SubtitlesModel : public QAbstractItemModel { Q_OBJECT Q_PROPERTY(int trackCount READ trackCount NOTIFY tracksChanged) public: enum Roles { TextRole = Qt::UserRole + 1, StartRole, EndRole, DurationRole, SimpleText, StartFrameRole, EndFrameRole, SiblingCountRole, }; struct SubtitleTrack { QString name; QString lang; }; explicit SubtitlesModel(QObject *parent = 0); virtual ~SubtitlesModel(); void load(Mlt::Producer *producer); bool isValid() const; int64_t maxTime() const; // Track Functions int trackCount() const; Q_INVOKABLE QModelIndex trackModelIndex(int trackIndex) const; QList<SubtitlesModel::SubtitleTrack> getTracks() const; int getTrackIndex(const QString &name); SubtitlesModel::SubtitleTrack getTrack(const QString &name); SubtitlesModel::SubtitleTrack getTrack(int index); void addTrack(SubtitlesModel::SubtitleTrack &track); void removeTrack(QString &name); void editTrack(int trackIndex, SubtitlesModel::SubtitleTrack &track); // Item Functions Q_INVOKABLE int itemCount(int trackIndex) const; int64_t endTime(int trackIndex) const; QModelIndex itemModelIndex(int trackIndex, int itemIndex) const; int itemIndexAtTime(int trackIndex, int64_t msTime) const; int itemIndexBeforeTime(int trackIndex, int64_t msTime) const; int itemIndexAfterTime(int trackIndex, int64_t msTime) const; const Subtitles::SubtitleItem &getItem(int trackIndex, int itemIndex) const; void importSubtitles(int trackIndex, int64_t msTime, QList<Subtitles::SubtitleItem> &items); void importSubtitlesToNewTrack(SubtitlesModel::SubtitleTrack &track, QList<Subtitles::SubtitleItem> &items); void exportSubtitles(const QString &filePath, int trackIndex) const; void overwriteItem(int trackIndex, const Subtitles::SubtitleItem &item); void appendItem(int trackIndex, const Subtitles::SubtitleItem &item); void removeItems(int trackIndex, int firstItemIndex, int lastItemIndex); void setItemStart(int trackIndex, int itemIndex, int64_t msTime); void setItemEnd(int trackIndex, int itemIndex, int64_t msTime); void setText(int trackIndex, int itemIndex, const QString &text); Q_INVOKABLE void moveItems(int trackIndex, int firstItemIndex, int lastItemIndex, int64_t msTime); Q_INVOKABLE bool validateMove(const QModelIndexList &items, int64_t msTime); // Only to be called by subtitle commands void doInsertTrack(const SubtitlesModel::SubtitleTrack &track, int trackIndex); void doRemoveTrack(int trackIndex); void doEditTrack(const SubtitlesModel::SubtitleTrack &track, int trackIndex); void doRemoveSubtitleItems(int trackIndex, const QList<Subtitles::SubtitleItem> &subtitles); void doInsertSubtitleItems(int trackIndex, const QList<Subtitles::SubtitleItem> &subtitles); void doSetText(int trackIndex, int itemIndex, const QString &text); void doSetTime(int trackIndex, int itemIndex, int64_t startTime, int64_t endTime); signals: void tracksChanged(int count); void modified(); protected: // Implement QAbstractItemModel int rowCount(const QModelIndex &parent) const; int columnCount(const QModelIndex &parent) const; QVariant data(const QModelIndex &index, int role) const; QVariant headerData(int section, Qt::Orientation orientation, int role) const; QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const; QModelIndex parent(const QModelIndex &index) const; QHash<int, QByteArray> roleNames() const; private: void requestFeedCommit(int trackIndex); void commitToFeed(int trackIndex); Mlt::Producer *m_producer; QList<SubtitlesModel::SubtitleTrack> m_tracks; QList<QList<Subtitles::SubtitleItem>> m_items; QTimer *m_commitTimer; int m_commitTrack; }; #endif // SUBTITLESMODEL_H
4,888
C++
.h
108
40.481481
102
0.752205
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,372
markersmodel.h
mltframework_shotcut/src/models/markersmodel.h
/* * Copyright (c) 2021-2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MARKERSMODEL_H #define MARKERSMODEL_H #include <MltProducer.h> #include <QAbstractItemModel> #include <QColor> #include <QString> namespace Markers { class Marker { public: QString text; int start {-1}; int end {-1}; QColor color; }; } class MarkersModel : public QAbstractItemModel { Q_OBJECT Q_PROPERTY(QStringList recentColors READ recentColors NOTIFY recentColorsChanged) public: enum Roles { TextRole = Qt::UserRole + 1, StartRole, EndRole, ColorRole, }; explicit MarkersModel(QObject *parent = 0); virtual ~MarkersModel(); void load(Mlt::Producer *producer); Markers::Marker getMarker(int markerIndex); int uniqueKey() const; int markerIndexForPosition(int position); int markerIndexForRange(int start, int end); int rangeMarkerIndexForPosition(int position); Q_INVOKABLE int nextMarkerPosition(int position); Q_INVOKABLE int prevMarkerPosition(int position); QModelIndex modelIndexForRow(int row); QMap<int, QString> ranges(); QStringList recentColors(); QList<Markers::Marker> getMarkers() const; QList<QColor> allColors() const; // These should only be called by the marker commands void doRemove(int markerIndex); void doInsert(int markerIndex, const Markers::Marker &marker); void doAppend(const Markers::Marker &marker); void doUpdate(int markerIndex, const Markers::Marker &marker); void doClear(); void doReplace(QList<Markers::Marker> &markers); void doShift(int shiftPosition, int shiftAmount); signals: void rangesChanged(); void modified(); void recentColorsChanged(); public slots: void remove(int markerIndex); void append(const Markers::Marker &marker); void update(int markerIndex, const Markers::Marker &marker); void move(int markerIndex, int start, int end); void setColor(int markerIndex, const QColor &color); void clear(); protected: // Implement QAbstractItemModel int rowCount(const QModelIndex &parent) const; int columnCount(const QModelIndex &parent) const; QVariant data(const QModelIndex &index, int role) const; QVariant headerData(int section, Qt::Orientation orientation, int role) const; QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const; QModelIndex parent(const QModelIndex &index) const; QHash<int, QByteArray> roleNames() const; private: int markerCount() const; int keyIndex(int key) const; Mlt::Properties *getMarkerProperties(int markerIndex); void updateRecentColors(const QColor &color); Mlt::Producer *m_producer; QList<int> m_keys; QMap<QRgb, QString> m_recentColors; }; #endif // MARKERSMODEL_H
3,465
C++
.h
96
32.125
96
0.739182
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,373
subtitlesselectionmodel.h
mltframework_shotcut/src/models/subtitlesselectionmodel.h
/* * Copyright (c) 2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SUBTITLESSELECTIONMODEL_H #define SUBTITLESSELECTIONMODEL_H #include <QItemSelectionModel> class SubtitlesSelectionModel : public QItemSelectionModel { Q_OBJECT Q_PROPERTY(QModelIndex selectedTrackModelIndex READ selectedTrackModelIndex NOTIFY selectedTrackModelIndexChanged) Q_PROPERTY(QVariantList selectedItems READ selectedItems NOTIFY selectedItemsChanged) public: explicit SubtitlesSelectionModel(QAbstractItemModel *model); QModelIndex selectedTrackModelIndex(); Q_INVOKABLE int selectedTrack(); void setSelectedTrack(int trackIndex); QVariantList selectedItems(); Q_INVOKABLE bool isItemSelected(int itemIndex); Q_INVOKABLE void selectItem(int itemIndex); Q_INVOKABLE void selectRange(int itemIndex); signals: void selectedTrackModelIndexChanged(QModelIndex trackModelIndex); void selectedItemsChanged(); private: int m_selectedTrackIndex; QVariantList m_selectedItems; int m_lastSingleSelection; }; #endif // SUBTITLESSELECTIONMODEL_H
1,731
C++
.h
43
36.906977
89
0.791196
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,374
subtitles.h
mltframework_shotcut/src/models/subtitles.h
/* * Copyright (c) 2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SUBTITLES_H #define SUBTITLES_H #include <cstdint> #include <string> #include <vector> namespace Subtitles { struct SubtitleItem { int64_t start; int64_t end; std::string text; }; typedef std::vector<Subtitles::SubtitleItem> SubtitleVector; SubtitleVector readFromSrtFile(const std::string &path); bool writeToSrtFile(const std::string &path, const SubtitleVector &items); SubtitleVector readFromSrtString(const std::string &text); bool writeToSrtString(std::string &text, const SubtitleVector &items); int indexForTime(const SubtitleVector &items, int64_t msTime, int searchStart, int msMargin); } // namespace Subtitles #endif // SUBTITLES_H
1,364
C++
.h
35
37
93
0.776097
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false