Commit 56536237 authored by Vincent Pinon's avatar Vincent Pinon

Fix compile warnings

parent cf60d92f
Pipeline #8189 passed with stage
in 18 minutes and 14 seconds
......@@ -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();
......
......@@ -240,14 +240,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();
}
}
......
......@@ -250,7 +250,7 @@ void ColorWheel::mouseReleaseEvent(QMouseEvent *event)
void ColorWheel::resizeEvent(QResizeEvent *event)
{
m_image = QImage(event->size(), QImage::Format_ARGB32_Premultiplied);
m_image.fill(palette().background().color().rgb());
m_image.fill(palette().window().color().rgb());
drawWheel();
drawSlider();
......
......@@ -54,7 +54,7 @@ template <typename Curve_t> void AbstractCurveWidget<Curve_t>::paintBackground(Q
/*
* Background
*/
p->fillRect(rect().translated(-offsetX, -offsetY), palette().background());
p->fillRect(rect().translated(-offsetX, -offsetY), palette().window());
if (!m_pixmap.isNull()) {
if (m_pixmapIsDirty || !m_pixmapCache) {
m_pixmapCache = std::make_shared<QPixmap>(m_wWidth + 1, m_wHeight + 1);
......
......@@ -156,7 +156,7 @@ void CubicBezierSpline::validatePoints()
void CubicBezierSpline::keepSorted()
{
qSort(m_points.begin(), m_points.end(), pointLessThan);
std::sort(m_points.begin(), m_points.end(), pointLessThan);
}
int CubicBezierSpline::indexOf(const BPoint &p)
......
......@@ -278,7 +278,7 @@ void KisCubicCurve::Data::invalidate()
void KisCubicCurve::Data::keepSorted()
{
qSort(points.begin(), points.end(), pointLessThan);
std::sort(points.begin(), points.end(), pointLessThan);
}
qreal KisCubicCurve::Data::value(qreal x)
......
......@@ -301,7 +301,7 @@ template <typename CurveWidget_t> void CurveParamWidget<CurveWidget_t>::slotShow
m_edit->setPixmap(QPixmap());
} else {
auto color = modeToColorsRGB(m_mode);
m_edit->setPixmap(QPixmap::fromImage(ColorTools::rgbCurvePlane(m_edit->size(), color, 1, palette().background().color().rgb())));
m_edit->setPixmap(QPixmap::fromImage(ColorTools::rgbCurvePlane(m_edit->size(), color, 1, palette().window().color().rgb())));
}
} else {
m_edit->setPixmap(QPixmap());
......
......@@ -168,7 +168,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};
}
......@@ -400,7 +400,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()) {
......
......@@ -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);
......
......@@ -29,9 +29,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)
{
......
......@@ -129,7 +129,7 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QMap<QString, QString> mappable_a
// Mime types
QStringList mimes = ClipCreationDialog::getExtensions();
qSort(mimes);
std::sort(mimes.begin(), mimes.end());
m_configEnv.supportedmimes->setPlainText(mimes.join(QLatin1Char(' ')));
m_page2 = addPage(p2, i18n("Environment"));
......@@ -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 */
}
......@@ -1035,7 +1041,7 @@ void KdenliveSettingsDialog::updateSettings()
// Update list
KdenliveSettings::setAddedExtensions(m_configEnv.kcfg_addedExtensions->text());
QStringList mimes = ClipCreationDialog::getExtensions();
qSort(mimes);
std::sort(mimes.begin(), mimes.end());
m_configEnv.supportedmimes->setPlainText(mimes.join(QLatin1Char(' ')));
}
......
......@@ -26,6 +26,7 @@
#include <QQuickItem>
#include <QQuickWindow>
#include <QStandardPaths>
#include <kdeclarative_version.h>
Splash::Splash(QObject *parent)
: QObject(parent)
......
......@@ -125,7 +125,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();
......
......@@ -95,7 +95,7 @@ void DvdWizardChapters::slotAddChapter()
for (int i = 0; i < currentChaps.count(); ++i) {
chapterTimes.append(currentChaps.at(i).toInt());
}
qSort(chapterTimes);
std::sort(chapterTimes.begin(), chapterTimes.end());
// rebuild chapters
QStringList chaptersString;
......
......@@ -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]);
}
}
......
......@@ -286,7 +286,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++) {
......@@ -3553,7 +3553,7 @@ void MainWindow::showTimelineToolbarMenu(const QPoint &pos)
avSizes = theme->querySizes(KIconLoader::Toolbar);
}
qSort(avSizes);
std::sort(avSizes.begin(), avSizes.end());
if (avSizes.count() < 10) {
// Fixed or threshold type icons
......
......@@ -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";
......
......@@ -52,6 +52,7 @@
#include "kdenlive_debug.h"
#include <QDesktopWidget>
#include <QScreen>
#include <QDrag>
#include <QFileDialog>
#include <QMenu>
......@@ -530,7 +531,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) {
......@@ -778,22 +779,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();
......@@ -877,7 +874,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)
......@@ -916,7 +913,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");
......@@ -245,6 +244,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
......
......@@ -34,12 +34,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();
......@@ -63,8 +60,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);
......@@ -72,7 +67,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;
......@@ -94,8 +89,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);
......@@ -105,7 +98,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;
......
......@@ -46,7 +46,7 @@ SimpleTimelineWidget::SimpleTimelineWidget(QWidget *parent)
void SimpleTimelineWidget::setKeyframes(const QList<int> &keyframes)
{
m_keyframes = keyframes;
qSort(m_keyframes);
std::sort(m_keyframes.begin(), m_keyframes.end());
m_currentKeyframe = m_currentKeyframeOriginal = -1;
emit atKeyframe(m_keyframes.contains(m_position));
update();
......@@ -68,7 +68,7 @@ void SimpleTimelineWidget::slotAddKeyframe(int pos, int select)
}
m_keyframes.append(pos);
qSort(m_keyframes);
std::sort(m_keyframes.begin(), m_keyframes.end());
if (select != 0) {
m_currentKeyframe = m_currentKeyframeOriginal = pos;
}
......@@ -220,7 +220,7 @@ void SimpleTimelineWidget::mouseReleaseEvent(QMouseEvent *event)
Q_UNUSED(event)
if (m_currentKeyframe >= 0) {
qSort(m_keyframes);
std::sort(m_keyframes.begin(), m_keyframes.end());
emit keyframeMoved(m_currentKeyframeOriginal, m_currentKeyframe);
}
}
......@@ -245,7 +245,7 @@ void SimpleTimelineWidget::mouseDoubleClickEvent(QMouseEvent *event)
// add new keyframe
m_keyframes.append(pos);
qSort(m_keyframes);
std::sort(m_keyframes.begin(), m_keyframes.end());
emit keyframeAdded(pos);
if (pos == m_position) {
emit atKeyframe(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;
};
......
......@@ -343,7 +343,7 @@ void PreviewManager::invalidatePreviews(const QVariantList chunks)
}
}
if (!foundChunks.isEmpty()) {
qSort(foundChunks);
std::sort(foundChunks.begin(), foundChunks.end());