Commit 11a390a4 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle

Merge branch '1908'

parents b081e6ef d02863d2
Pipeline #8193 passed with stage
in 19 minutes and 31 seconds
......@@ -12,7 +12,7 @@
<parameter type="bool" name="use_normalised" default="0">
<name>Normalise</name>
</parameter>
<parameter type="color" name="background" default="colour:0x00000000" alpha="1" paramprefix="colour:">
<parameter type="color" name="producer.resource" default="0x00000000" alpha="1">
<name>Background Color</name>
</parameter>
</effect>
......@@ -36,7 +36,7 @@
<parameter type="geometry" name="transition.geometry" default="0 0:100% 100%" fixed="1" opacity="false">
<name>Pan and Zoom</name>
</parameter>
<parameter type="color" name="background" default="colour:0x00000000" alpha="1" paramprefix="colour:">
<parameter type="color" name="producer.resource" default="0x00000000" alpha="1">
<name>Background Color</name>
</parameter>
</effect>
......@@ -18,7 +18,7 @@
<parameter type="simplekeyframe" name="transition.oy" max="32000" min="-32000" default="0" notintimeline="1">
<name>Offset Y</name>
</parameter>
<parameter type="color" name="background" default="colour:0x00000000" alpha="1" paramprefix="colour:">
<parameter type="color" name="producer.resource" default="0x00000000" alpha="1">
<name>Background Color</name>
</parameter>
<parameter type="fixed" name="transition.keyed" max="1" min="1" default="1" />
......
......@@ -360,7 +360,6 @@ void KeyframeModelList::resizeKeyframes(int oldIn, int oldOut, int in, int out,
if (offset != 0) {
// this is an endless resize clip
GenTime old_in(oldIn, pCore->getCurrentFps());
Keyframe kf = getKeyframe(old_in, &ok);
GenTime new_in(in + offset, pCore->getCurrentFps());
getKeyframe(new_in, &ok2);
positions = m_parameters.begin()->second->getKeyframePos();
......
......@@ -239,14 +239,14 @@ void AssetParameterView::refresh(const QModelIndex &topLeft, const QModelIndex &
m_widgets[0]->slotRefresh();
return;
}
int max;
size_t max;
if (!bottomRight.isValid()) {
max = (int)m_widgets.size() - 1;
max = m_widgets.size() - 1;
} else {
max = bottomRight.row();
max = (size_t)bottomRight.row();
}
Q_ASSERT(max < (int)m_widgets.size());
for (auto i = (size_t)topLeft.row(); i <= max; ++i) {
Q_ASSERT(max < m_widgets.size());
for (size_t i = (size_t)topLeft.row(); i <= max; ++i) {
m_widgets[i]->slotRefresh();
}
}
......
......@@ -166,7 +166,7 @@ public:
QString line1 = index.data(Qt::DisplayRole).toString();
QString line2 = index.data(Qt::UserRole).toString();
int textW = qMax(option.fontMetrics.width(line1), option.fontMetrics.width(line2));
int textW = qMax(option.fontMetrics.horizontalAdvance(line1), option.fontMetrics.horizontalAdvance(line2));
QSize iconSize = icon.actualSize(option.decorationSize);
return {qMax(textW, iconSize.width()) + 4, option.fontMetrics.lineSpacing() * 2 + 4};
}
......@@ -398,7 +398,6 @@ void MyListView::focusInEvent(QFocusEvent *event)
void MyListView::mouseMoveEvent(QMouseEvent *event)
{
bool dragged = false;
if (event->modifiers() == Qt::ShiftModifier) {
QModelIndex index = indexAt(event->pos());
if (index.isValid()) {
......@@ -3120,8 +3119,10 @@ void Bin::reloadAllProducers()
// Make sure we reload clip length
xml.removeAttribute(QStringLiteral("out"));
Xml::removeXmlProperty(xml, QStringLiteral("length"));
clip->resetProducerProperty(QStringLiteral("kdenlive:duration"));
clip->resetProducerProperty(QStringLiteral("length"));
if (clip->isValid()) {
clip->resetProducerProperty(QStringLiteral("kdenlive:duration"));
clip->resetProducerProperty(QStringLiteral("length"));
}
if (!xml.isNull()) {
clip->setClipStatus(AbstractProjectItem::StatusWaiting);
clip->discardAudioThumb();
......
......@@ -336,7 +336,7 @@ std::vector<size_t> MarkerListModel::getSnapPoints() const
READ_LOCK();
std::vector<size_t> markers;
for (const auto &marker : m_markerList) {
markers.push_back(marker.first.frames(pCore->getCurrentFps()));
markers.push_back((size_t)marker.first.frames(pCore->getCurrentFps()));
}
return markers;
}
......
......@@ -45,7 +45,7 @@ ProjectSubClip::ProjectSubClip(const QString &id, const std::shared_ptr<ProjectC
m_inPoint = in;
m_outPoint = out;
m_duration = timecode;
m_parentDuration = m_masterClip->frameDuration();
m_parentDuration = (int)m_masterClip->frameDuration();
m_parentClipId = m_masterClip->clipId();
QPixmap pix(64, 36);
pix.fill(Qt::lightGray);
......
......@@ -30,9 +30,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
MediaCapture::MediaCapture(QObject *parent)
: QObject(parent)
, m_volume(1.)
, currentState(-1)
, m_audioDevice("default:")
, m_volume(1.)
, m_path(QUrl())
, m_recordState(0)
{
......
......@@ -562,6 +562,8 @@ void KdenliveSettingsDialog::setupJogshuttleBtns(const QString &device)
button->setCurrentIndex(action_pos[actions_map[i]]);
}
}
#else
Q_UNUSED(device)
#endif
}
......@@ -757,6 +759,8 @@ void KdenliveSettingsDialog::slotCheckShuttle(int state)
if (state != 0) {
setupJogshuttleBtns(m_configShuttle.shuttledevicelist->itemData(m_configShuttle.shuttledevicelist->currentIndex()).toString());
}
#else
Q_UNUSED(state)
#endif /* USE_JOGSHUTTLE */
}
......@@ -767,6 +771,8 @@ void KdenliveSettingsDialog::slotUpdateShuttleDevice(int ix)
// KdenliveSettings::setShuttledevice(device);
setupJogshuttleBtns(device);
m_configShuttle.kcfg_shuttledevice->setText(device);
#else
Q_UNUSED(ix)
#endif /* USE_JOGSHUTTLE */
}
......
......@@ -26,6 +26,7 @@
#include <QQuickItem>
#include <QQuickWindow>
#include <QStandardPaths>
#include <kdeclarative_version.h>
Splash::Splash(QObject *parent)
: QObject(parent)
......
......@@ -124,7 +124,7 @@ int KThumb::imageVariance(const QImage &image)
{
int delta = 0;
int avg = 0;
int bytes = image.byteCount();
int bytes = (int)image.sizeInBytes();
int STEPS = bytes / 2;
QVarLengthArray<uchar> pivot(STEPS);
const uchar *bits = image.bits();
......
......@@ -28,6 +28,7 @@
#include <KDeclarative/KDeclarative>
#include <QQmlContext>
#include <QQuickItem>
#include <kdeclarative_version.h>
BuiltStack::BuiltStack(AssetPanel *parent)
: QQuickWidget(parent)
......
......@@ -72,7 +72,7 @@ bool CacheJob::startJob()
qDebug() << "********\nCOULD NOT READ THUMB PRODUCER\n********";
return false;
}
int duration = m_outPoint > 0 ? m_outPoint - m_inPoint : m_binClip->frameDuration();
int duration = m_outPoint > 0 ? m_outPoint - m_inPoint : (int)m_binClip->frameDuration();
if (m_thumbsCount * 5 > duration) {
m_thumbsCount = duration / 10;
}
......@@ -80,7 +80,7 @@ bool CacheJob::startJob()
for (int i = 1; i <= m_thumbsCount; ++i) {
frames.insert(m_inPoint + (duration * i / m_thumbsCount));
}
int size = frames.size();
int size = (int)frames.size();
int count = 0;
connect(this, &CacheJob::jobCanceled, [&] () {
m_clipId.clear();
......@@ -111,6 +111,8 @@ bool CacheJob::startJob()
bool CacheJob::commitResult(Fun &undo, Fun &redo)
{
Q_UNUSED(undo)
Q_UNUSED(redo)
Q_ASSERT(!m_resultConsumed);
m_resultConsumed = true;
return m_done;
......
......@@ -211,7 +211,7 @@ QHash<ProjectClip *, AbstractClipJob *> FilterJob::prepareJob(const QList<Projec
if (clips.count() == 1) {
out = clips.constFirst()->duration().frames(KdenliveSettings::project_fps());
}
QPointer<ClipStabilize> d = new ClipStabilize(sources, filterName, out);
QPointer<ClipStabilize> d = new ClipStabilize(sources, filterName);
if (d->exec() == QDialog::Accepted) {
QMap<QString, QString> producerParams = d->producerParams();
QMap<QString, QString> filterParams = d->filterParams();
......
......@@ -86,7 +86,7 @@ int StabilizeJob::prepareJob(const std::shared_ptr<JobManager> &ptr, const std::
Q_ASSERT(supportedFilters().count(filterName) > 0);
if (filterName == QLatin1String("vidstab")) {
// vidstab
QScopedPointer<ClipStabilize> d(new ClipStabilize(binIds, filterName, 100000));
QScopedPointer<ClipStabilize> d(new ClipStabilize(binIds, filterName));
if (d->exec() == QDialog::Accepted) {
std::unordered_map<QString, QString> filterParams = d->filterParams();
QString destination = d->destination();
......
......@@ -32,7 +32,7 @@ AudioEnvelope::AudioEnvelope(const QString &binId, int clipId, size_t offset, si
m_offset = 0;
m_producer->set_in_and_out((int) offset, (int) (offset + length));
}
m_envelopeSize = m_producer->get_playtime();
m_envelopeSize = (size_t)m_producer->get_playtime();
m_producer->set("set.test_image", 1);
connect(&m_watcher, &QFutureWatcherBase::finished, this, [this] { envelopeReady(this); });
......
......@@ -48,13 +48,13 @@ void FFTCorrelation::correlate(const qint64 *left, const size_t leftSize, const
qint64 maxLeft = 1;
qint64 maxRight = 1;
for (size_t i = 0; i < leftSize; ++i) {
if (labs(left[i]) > maxLeft) {
maxLeft = labs(left[i]);
if (qAbs(left[i]) > maxLeft) {
maxLeft = qAbs(left[i]);
}
}
for (size_t i = 0; i < rightSize; ++i) {
if (labs(right[i]) > maxRight) {
maxRight = labs(right[i]);
if (qAbs(right[i]) > maxRight) {
maxRight = qAbs(right[i]);
}
}
......
......@@ -284,7 +284,7 @@ void MainWindow::init()
grabLayout->addWidget(recToolbar);
grabLayout->addStretch(10);
// Check number of monitors for FFmpeg screen capture
int screens = QApplication::desktop()->screenCount();
int screens = QApplication::screens().count();
if (screens > 1) {
QComboBox *screenCombo = new QComboBox(recToolbar);
for (int ix = 0; ix < screens; ix++) {
......
......@@ -50,8 +50,8 @@ ClipController::ClipController(const QString &clipId, const std::shared_ptr<Mlt:
, m_effectStack(producer ? EffectStackModel::construct(producer, {ObjectType::BinClip, clipId.toInt()}, pCore->undoStack()) : nullptr)
, m_hasAudio(false)
, m_hasVideo(false)
, m_controllerBinId(clipId)
, m_producerLock(QReadWriteLock::Recursive)
, m_controllerBinId(clipId)
{
if (m_masterProducer && !m_masterProducer->is_valid()) {
qCDebug(KDENLIVE_LOG) << "// WARNING, USING INVALID PRODUCER";
......
......@@ -51,6 +51,7 @@
#include "kdenlive_debug.h"
#include <QDesktopWidget>
#include <QScreen>
#include <QDrag>
#include <QMenu>
#include <QMimeData>
......@@ -528,7 +529,7 @@ void Monitor::slotForceSize(QAction *a)
int profileHeight = 200;
if (resizeType > 0) {
// calculate size
QRect r = QApplication::desktop()->screenGeometry();
QRect r = QApplication::primaryScreen()->geometry();
profileHeight = m_glMonitor->profileSize().height() * resizeType / 100;
profileWidth = pCore->getCurrentProfile()->dar() * profileHeight;
if (profileWidth > r.width() * 0.8 || profileHeight > r.height() * 0.7) {
......@@ -776,22 +777,18 @@ void Monitor::slotSwitchFullScreen(bool minimizeOnly)
{
// TODO: disable screensaver?
if (!m_glWidget->isFullScreen() && !minimizeOnly) {
// Check if we have a multiple monitor setup
int monitors = QApplication::desktop()->screenCount();
int screen = -1;
if (monitors > 1) {
QRect screenres;
// Move monitor widget to the second screen (one screen for Kdenlive, the other one for the Monitor widget
// int currentScreen = QApplication::desktop()->screenNumber(this);
for (int i = 0; screen == -1 && i < QApplication::desktop()->screenCount(); i++) {
if (i != QApplication::desktop()->screenNumber(this->parentWidget()->parentWidget())) {
screen = i;
// Move monitor widget to the second screen (one screen for Kdenlive, the other one for the Monitor widget)
if (qApp->screens().count() > 1) {
for (auto screen : qApp->screens()) {
if (screen != qApp->screenAt(this->parentWidget()->pos())) {
m_glWidget->setParent(qApp->desktop()->screen(qApp->screens().indexOf(screen)));
break;
}
}
} else {
m_glWidget->setParent(qApp->desktop()->screen(0));
}
m_qmlManager->enableAudioThumbs(false);
m_glWidget->setParent(QApplication::desktop()->screen(screen));
m_glWidget->move(QApplication::desktop()->screenGeometry(screen).bottomLeft());
m_glWidget->showFullScreen();
} else {
m_glWidget->showNormal();
......@@ -875,7 +872,7 @@ void Monitor::slotStartDrag()
/*QPixmap pix = m_currentClip->thumbnail();
drag->setPixmap(pix);
drag->setHotSpot(QPoint(0, 50));*/
drag->start(Qt::MoveAction);
drag->exec(Qt::MoveAction);
}
void Monitor::enterEvent(QEvent *event)
......@@ -914,7 +911,7 @@ void Monitor::mouseMoveEvent(QMouseEvent *event)
clipData.append(list.join(QLatin1Char(';')).toUtf8());
mimeData->setData(QStringLiteral("kdenlive/clip"), clipData);
drag->setMimeData(mimeData);
drag->start(Qt::MoveAction);
drag->exec(Qt::MoveAction);
}
event->accept();
}
......
......@@ -31,7 +31,7 @@
#include <KMessageBox>
#include <QComboBox>
#include <QDesktopWidget>
#include <QScreen>
#include <QDir>
#include <QFile>
#include <QMenu>
......@@ -227,7 +227,6 @@ void RecManager::slotRecord(bool record)
}
m_captureFile = QUrl::fromLocalFile(path);
QString captureSize;
QRect screenSize = QApplication::desktop()->screenGeometry(m_screenIndex);
QStringList captureArgs;
#ifdef Q_OS_WIN
captureArgs << QStringLiteral("-f") << QStringLiteral("gdigrab");
......@@ -272,6 +271,7 @@ void RecManager::slotRecord(bool record)
captureSize = QStringLiteral(":0.0");
if (KdenliveSettings::grab_capture_type() == 0) {
// Full screen capture
QRect screenSize = QApplication::screens()[m_screenIndex]->geometry();
captureArgs << QStringLiteral("-s") << QString::number(screenSize.width()) + QLatin1Char('x') + QString::number(screenSize.height());
captureSize.append(QLatin1Char('+') + QString::number(screenSize.left()) + QLatin1Char('.') + QString::number(screenSize.top()));
} else {
......
......@@ -138,7 +138,7 @@ AudioGraphWidget::AudioGraphWidget(QWidget *parent)
m_freqLabels << BAND_TAB[i].label;
}
m_maxDb = 0;
setMinimumWidth(2 * m_freqLabels.size() + fontMetrics().width(QStringLiteral("888")) + 2);
setMinimumWidth(2 * m_freqLabels.size() + fontMetrics().horizontalAdvance(QStringLiteral("888")) + 2);
setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
setMinimumHeight(100);
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
......@@ -159,14 +159,14 @@ void AudioGraphWidget::drawDbLabels(QPainter &p, const QRect &rect)
return;
}
int maxWidth = fontMetrics().width(QStringLiteral("-45"));
int maxWidth = fontMetrics().horizontalAdvance(QStringLiteral("-45"));
// dB scale is vertical along the left side
int prevY = height();
QColor textCol = palette().text().color();
p.setPen(textCol);
for (int i = 0; i < dbLabelCount; i++) {
QString label = QString::number(m_dbLabels.at(i));
int x = rect.left() + maxWidth - fontMetrics().width(label);
int x = rect.left() + maxWidth - fontMetrics().horizontalAdvance(label);
int yline = rect.bottom() - pow(10.0, (double)m_dbLabels.at(i) / 50.0) * rect.height() * 40.0 / 42;
int y = yline + textHeight / 2;
if (y - textHeight < 0) {
......@@ -196,7 +196,7 @@ void AudioGraphWidget::drawChanLabels(QPainter &p, const QRect &rect, int barWid
// Find the widest channel label
int chanLabelWidth = 0;
for (int i = 0; i < chanLabelCount; i++) {
int width = fontMetrics().width(m_freqLabels.at(i)) + 2;
int width = fontMetrics().horizontalAdvance(m_freqLabels.at(i)) + 2;
chanLabelWidth = width > chanLabelWidth ? width : chanLabelWidth;
}
int length = rect.width();
......@@ -208,10 +208,10 @@ void AudioGraphWidget::drawChanLabels(QPainter &p, const QRect &rect, int barWid
int y = rect.bottom();
for (int i = 0; i < chanLabelCount; i += stride) {
QString label = m_freqLabels.at(i);
int x = rect.left() + (2 * i) + i * barWidth + barWidth / 2 - fontMetrics().width(label) / 2;
int x = rect.left() + (2 * i) + i * barWidth + barWidth / 2 - fontMetrics().horizontalAdvance(label) / 2;
if (x > prevX) {
p.drawText(x, y, label);
prevX = x + fontMetrics().width(label);
prevX = x + fontMetrics().horizontalAdvance(label);
}
}
}
......@@ -237,7 +237,7 @@ void AudioGraphWidget::drawBackground()
QRect rect(0, 0, width() - 3, height());
p.setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
p.setOpacity(0.6);
int offset = fontMetrics().width(QStringLiteral("888")) + 2;
int offset = fontMetrics().horizontalAdvance(QStringLiteral("888")) + 2;
if (rect.width() - offset > 10) {
drawDbLabels(p, rect);
rect.adjust(offset, 0, 0, 0);
......
......@@ -153,7 +153,7 @@ void MonitorAudioLevel::drawBackground(int channels)
for (int i = 0; i < dbLabelCount; i++) {
int value = dbscale.at(i);
QString label = QString().sprintf("%d", value);
int labelWidth = fontMetrics().width(label);
int labelWidth = fontMetrics().horizontalAdvance(label);
double xf = pow(10.0, (double)dbscale.at(i) / 50.0) * m_pixmap.width() * 40.0 / 42;
if (xf + labelWidth / 2 > m_pixmap.width()) {
xf = width() - labelWidth / 2;
......
......@@ -33,7 +33,7 @@
#include <QFontDatabase>
#include <mlt++/Mlt.h>
ClipStabilize::ClipStabilize(const std::vector<QString> &binIds, QString filterName, int out, QWidget *parent)
ClipStabilize::ClipStabilize(const std::vector<QString> &binIds, QString filterName, QWidget *parent)
: QDialog(parent)
, m_filtername(std::move(filterName))
, m_binIds(binIds)
......
......@@ -35,7 +35,7 @@ class ClipStabilize : public QDialog, public Ui::ClipStabilize_UI
Q_OBJECT
public:
explicit ClipStabilize(const std::vector<QString> &binIds, QString filterName, int out, QWidget *parent = nullptr);
explicit ClipStabilize(const std::vector<QString> &binIds, QString filterName, QWidget *parent = nullptr);
~ClipStabilize() override;
/** @brief Should the generated clip be added to current project. */
bool autoAddClip() const;
......
......@@ -76,7 +76,7 @@ QImage AudioSignal::renderAudioScope(uint, const audioShortVector &audioFrame, c
int dbsize = 20;
if (!horiz) {
// calculate actual width of lowest=longest db scale mark based on drawing font
dbsize = p.fontMetrics().width(QString().sprintf("%d", m_dbscale.at(m_dbscale.size() - 1)));
dbsize = p.fontMetrics().horizontalAdvance(QString().sprintf("%d", m_dbscale.at(m_dbscale.size() - 1)));
}
bool showdb = width() > (dbsize + 40);
// valpixel=1.0 for 127, 1.0+(1/40) for 1 short oversample, 1.0+(2/40) for longer oversample
......
......@@ -35,12 +35,9 @@ ScopeManager::ScopeManager(QObject *parent)
: QObject(parent)
{
m_signalMapper = new QSignalMapper(this);
connect(pCore->monitorManager(), &MonitorManager::checkColorScopes, this, &ScopeManager::slotUpdateActiveRenderer);
connect(pCore->monitorManager(), &MonitorManager::clearScopes, this, &ScopeManager::slotClearColorScopes);
connect(pCore->monitorManager(), &MonitorManager::checkScopes, this, &ScopeManager::slotCheckActiveScopes);
connect(m_signalMapper, SIGNAL(mapped(QString)), SLOT(slotRequestFrame(QString)));
slotUpdateActiveRenderer();
......@@ -64,8 +61,6 @@ bool ScopeManager::addScope(AbstractAudioScopeWidget *audioScope, QDockWidget *a
qCDebug(KDENLIVE_LOG) << "Adding scope to scope manager: " << audioScope->widgetName();
#endif
m_signalMapper->setMapping(audioScopeWidget, QString(audioScope->widgetName()));
AudioScopeData asd;
asd.scope = audioScope;
m_audioScopes.append(asd);
......@@ -73,7 +68,7 @@ bool ScopeManager::addScope(AbstractAudioScopeWidget *audioScope, QDockWidget *a
connect(audioScope, &AbstractScopeWidget::requestAutoRefresh, this, &ScopeManager::slotCheckActiveScopes);
if (audioScopeWidget != nullptr) {
connect(audioScopeWidget, &QDockWidget::visibilityChanged, this, &ScopeManager::slotCheckActiveScopes);
connect(audioScopeWidget, SIGNAL(visibilityChanged(bool)), m_signalMapper, SLOT(map()));
connect(audioScopeWidget, &QDockWidget::visibilityChanged, this, [this, audioScope](){slotRequestFrame(QString(audioScope->widgetName()));});
}
added = true;
......@@ -95,8 +90,6 @@ bool ScopeManager::addScope(AbstractGfxScopeWidget *colorScope, QDockWidget *col
qCDebug(KDENLIVE_LOG) << "Adding scope to scope manager: " << colorScope->widgetName();
#endif
m_signalMapper->setMapping(colorScopeWidget, QString(colorScope->widgetName()));
GfxScopeData gsd;
gsd.scope = colorScope;
m_colorScopes.append(gsd);
......@@ -106,7 +99,7 @@ bool ScopeManager::addScope(AbstractGfxScopeWidget *colorScope, QDockWidget *col
connect(colorScope, &AbstractScopeWidget::signalScopeRenderingFinished, this, &ScopeManager::slotScopeReady);
if (colorScopeWidget != nullptr) {
connect(colorScopeWidget, &QDockWidget::visibilityChanged, this, &ScopeManager::slotCheckActiveScopes);
connect(colorScopeWidget, SIGNAL(visibilityChanged(bool)), m_signalMapper, SLOT(map()));
connect(colorScopeWidget, &QDockWidget::visibilityChanged, this, [this, colorScope](){slotRequestFrame(QString(colorScope->widgetName()));});
}
added = true;
......
......@@ -64,7 +64,7 @@ TimecodeDisplay::TimecodeDisplay(const Timecode &t, QWidget *parent)
setPalette(palette);
setTimeCodeFormat(KdenliveSettings::frametimecode(), true);
setValue(m_minimum);
setMinimumWidth(fm.width(QStringLiteral("88:88:88:88")) + contentsMargins().right() + contentsMargins().left() + frameSize().width() -
setMinimumWidth(fm.horizontalAdvance(QStringLiteral("88:88:88:88")) + contentsMargins().right() + contentsMargins().left() + frameSize().width() -
lineEdit()->contentsRect().width() + (int)QStyle::PM_SpinBoxFrameWidth + 6);
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Maximum);
......
......@@ -180,7 +180,6 @@ bool TimelineFunctions::requestClipCut(const std::shared_ptr<TimelineItemModel>
int count = 0;
QList<int> newIds;
int mainId = -1;
QList<int> clipsToCut;
for (int cid : clips) {
if (!timeline->isClip(cid)) {
......@@ -204,9 +203,6 @@ bool TimelineFunctions::requestClipCut(const std::shared_ptr<TimelineItemModel>
Q_ASSERT(undone);
return false;
}
if (cid == clipId) {
mainId = newId;
}
// splitted elements go temporarily in the same group as original ones.
timeline->m_groups->setInGroupOf(newId, cid, undo, redo);
newIds << newId;
......@@ -613,14 +609,12 @@ bool TimelineFunctions::changeClipState(const std::shared_ptr<TimelineItemModel>
{
int track = timeline->getClipTrackId(clipId);
int start = -1;
int end = -1;
bool invalidate = false;
if (track > -1) {
if (!timeline->getTrackById_const(track)->isAudioTrack()) {
invalidate = true;
}
start = timeline->getItemPosition(clipId);
end = start + timeline->getItemPlaytime(clipId);
}
Fun local_undo = []() { return true; };
Fun local_redo = []() { return true; };
......@@ -1283,7 +1277,6 @@ bool TimelineFunctions::pasteClips(const std::shared_ptr<TimelineItemModel> &tim
//qDebug()<<"== GOT WANTED TKS\n VIDEO: "<<videoTracks<<"\n AUDIO TKS: "<<audioTracks<<"\n SINGLE AUDIO: "<<singleAudioTracks;
int requestedVideoTracks = videoTracks.isEmpty() ? 0 : videoTracks.last() - videoTracks.first() + 1;
int requestedAudioTracks = audioTracks.isEmpty() ? 0 : audioTracks.last() - audioTracks.first() + 1;
int requestedSingleAudioTracks = singleAudioTracks.isEmpty() ? 0 : singleAudioTracks.last() - singleAudioTracks.first() + 1;
if (requestedVideoTracks > projectTracks.second.size() || requestedAudioTracks > projectTracks.first.size()) {
pCore->displayMessage(i18n("Not enough tracks to paste clipboard"), InformationMessage, 500);
return false;
......
......@@ -105,6 +105,7 @@ int TimelineModel::seekDuration = 30000;
TimelineModel::TimelineModel(Mlt::Profile *profile, std::weak_ptr<DocUndoStack> undo_stack)
: QAbstractItemModel_shared_from_this()
, m_blockRefresh(false)
, m_tractor(new Mlt::Tractor(*profile))
, m_snaps(new SnapModel())
, m_undoStack(std::move(undo_stack))
......@@ -117,7 +118,6 @@ TimelineModel::TimelineModel(Mlt::Profile *profile, std::weak_ptr<DocUndoStack>
, m_audioTarget(-1)
, m_videoTarget(-1)
, m_editMode(TimelineMode::NormalEdit)
, m_blockRefresh(false)
, m_closing(false)
{
// Create black background track
......@@ -2234,7 +2234,7 @@ void TimelineModel::registerTrack(std::shared_ptr<TrackModel> track, int pos, bo
// it now contains the iterator to the inserted element, we store it
Q_ASSERT(m_iteratorTable.count(id) == 0); // check that id is not used (shouldn't happen)
m_iteratorTable[id] = it;
int cache = QThread::idealThreadCount() + (m_allTracks.size() + 1) * 2;
int cache = (int)QThread::idealThreadCount() + ((int)m_allTracks.size() + 1) * 2;
mlt_service_cache_set_size(NULL, "producer_avformat", qMax(4, cache));
}
......@@ -2268,7 +2268,7 @@ Fun TimelineModel::deregisterTrack_lambda(int id, bool updateView)
if (updateView) {
_resetView();
}
int cache = QThread::idealThreadCount() + (m_allTracks.size() + 1) * 2;
int cache = (int)QThread::idealThreadCount() + ((int)m_allTracks.size() + 1) * 2;
mlt_service_cache_set_size(NULL, "producer_avformat", qMax(4, cache));
return true;
};
......
......@@ -927,7 +927,7 @@ void TimelineController::setPosition(int position)
void TimelineController::setAudioTarget(int track)
{
if (track > -1 && !m_model->isTrack(track) || !m_hasAudioTarget) {
if ((track > -1 && !m_model->isTrack(track)) || !m_hasAudioTarget) {
return;
}
m_model->m_audioTarget = track;
......@@ -936,7 +936,7 @@ void TimelineController::setAudioTarget(int track)
void TimelineController::setVideoTarget(int track)
{
if (track > -1 && !m_model->isTrack(track) || !m_hasVideoTarget) {
if ((track > -1 && !m_model->isTrack(track)) || !m_hasVideoTarget) {
return;
}
m_model->m_videoTarget = track;
......@@ -1663,7 +1663,7 @@ bool TimelineController::insertClipZone(const QString &binId, int tid, int posit
int vTrack = -1;
std::shared_ptr<ProjectClip> clip = pCore->bin()->getBinClip(bid);
if (out <= in) {
out = clip->frameDuration() - 1;
out = (int)clip->frameDuration() - 1;
}
if (dropType == PlaylistState::VideoOnly) {
vTrack = tid;
......@@ -2578,7 +2578,6 @@ void TimelineController::finishRecording(const QString &recordedFile)
return;
}
qDebug() << "callback " << binId << " " << m_recordTrack << ", MAXIMUM SPACE: " << m_recordStart.second;
bool res = false;
if (m_recordStart.second > 0) {
// Limited space on track
std::shared_ptr<ProjectClip> clip = pCore->bin()->getBinClip(binId);
......@@ -2587,9 +2586,9 @@ void TimelineController::finishRecording(const QString &recordedFile)
}
int out = qMin((int)clip->frameDuration() - 1, m_recordStart.second - 1);
QString binClipId = QString("%1/%2/%3").arg(binId).arg(0).arg(out);
res = m_model->requestClipInsertion(binClipId, m_recordTrack, m_recordStart.first, id, true, true, false);
m_model->requestClipInsertion(binClipId, m_recordTrack, m_recordStart.first, id, true, true, false);
} else {
res = m_model->requestClipInsertion(binId, m_recordTrack, m_recordStart.first, id, true, true, false);
m_model->requestClipInsertion(binId, m_recordTrack, m_recordStart.first, id, true, true, false);
}
};
QString binId =
......
......@@ -189,10 +189,10 @@ void MyTextItem::updateGeometry(int, int, int)
linePath.addText(0, linePos, font(), line);
linePos += lineSpacing;
if (m_alignment == Qt::AlignHCenter) {
double offset = (bounding.width() - metrics.width(line)) / 2;
double offset = (bounding.width() - metrics.horizontalAdvance(line)) / 2;
linePath.translate(offset, 0);
} else if (m_alignment == Qt::AlignRight) {
double offset = bounding.width() - metrics.width(line);
double offset = bounding.width() - metrics.horizontalAdvance(line);
linePath.translate(offset, 0);
}
m_path.addPath(linePath);
......
......@@ -214,20 +214,10 @@ TitleWidget::TitleWidget(const QUrl &url, const Timecode &tc, QString projectTit
connect(monitor, &Monitor::frameUpdated, this, &TitleWidget::slotGotBackground);
// Position and size
m_signalMapper = new QSignalMapper(this);
m_signalMapper->setMapping(value_w, ValueWidth);
m_signalMapper->setMapping(value_h, ValueHeight);
m_signalMapper->setMapping(value_x, ValueX);
m_signalMapper->setMapping(value_y, ValueY);
connect(value_w, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), m_signalMapper,
static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
connect(value_h, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), m_signalMapper,
static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
connect(value_x, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), m_signalMapper,
static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
connect(value_y, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), m_signalMapper,
static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
connect(m_signalMapper, SIGNAL(mapped(int)), this, SLOT(slotValueChanged(int)));
connect(value_w, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, [this](int){slotValueChanged(ValueWidth);});
connect(value_h, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, [this](int){slotValueChanged(ValueHeight);});
connect(value_x, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, [this](int){slotValueChanged(ValueX);});
connect(value_y, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, [this](int){slotValueChanged(ValueY);});
connect(buttonFitZoom, &QAbstractButton::clicked, this, &TitleWidget::slotAdjustZoom);
connect(buttonRealSize, &QAbstractButton::clicked, this, &TitleWidget::slotZoomOneToOne);
......@@ -586,7 +576,6 @@ TitleWidget::~TitleWidget()
delete m_startViewport;
delete m_endViewport;
delete m_scene;
delete m_signalMapper;
}
// static
......