Commit 467dcdc2 authored by Vincent Pinon's avatar Vincent Pinon
Browse files

fix some more warnings

parent 635f9159
......@@ -1990,17 +1990,17 @@ void MainWindow::slotEditProjectSettings()
}
}
if (project->getDocumentProperty(QStringLiteral("generateproxy")) != QString::number((int)w->generateProxy())) {
if (project->getDocumentProperty(QStringLiteral("generateproxy")) != QString::number(int(w->generateProxy()))) {
modified = true;
project->setDocumentProperty(QStringLiteral("generateproxy"), QString::number((int)w->generateProxy()));
project->setDocumentProperty(QStringLiteral("generateproxy"), QString::number(int(w->generateProxy())));
}
if (project->getDocumentProperty(QStringLiteral("proxyminsize")) != QString::number(w->proxyMinSize())) {
modified = true;
project->setDocumentProperty(QStringLiteral("proxyminsize"), QString::number(w->proxyMinSize()));
}
if (project->getDocumentProperty(QStringLiteral("generateimageproxy")) != QString::number((int)w->generateImageProxy())) {
if (project->getDocumentProperty(QStringLiteral("generateimageproxy")) != QString::number(int(w->generateImageProxy()))) {
modified = true;
project->setDocumentProperty(QStringLiteral("generateimageproxy"), QString::number((int)w->generateImageProxy()));
project->setDocumentProperty(QStringLiteral("generateimageproxy"), QString::number(int(w->generateImageProxy())));
}
if (project->getDocumentProperty(QStringLiteral("proxyimageminsize")) != QString::number(w->proxyImageMinSize())) {
modified = true;
......@@ -2010,13 +2010,13 @@ void MainWindow::slotEditProjectSettings()
modified = true;
project->setDocumentProperty(QStringLiteral("proxyimagesize"), QString::number(w->proxyImageSize()));
}
if (QString::number((int)w->useProxy()) != project->getDocumentProperty(QStringLiteral("enableproxy"))) {
project->setDocumentProperty(QStringLiteral("enableproxy"), QString::number((int)w->useProxy()));
if (QString::number(int(w->useProxy())) != project->getDocumentProperty(QStringLiteral("enableproxy"))) {
project->setDocumentProperty(QStringLiteral("enableproxy"), QString::number(int(w->useProxy())));
modified = true;
slotUpdateProxySettings();
}
if (QString::number((int)w->useExternalProxy()) != project->getDocumentProperty(QStringLiteral("enableexternalproxy"))) {
project->setDocumentProperty(QStringLiteral("enableexternalproxy"), QString::number((int)w->useExternalProxy()));
if (QString::number(int(w->useExternalProxy())) != project->getDocumentProperty(QStringLiteral("enableexternalproxy"))) {
project->setDocumentProperty(QStringLiteral("enableexternalproxy"), QString::number(int(w->useExternalProxy())));
modified = true;
}
if (w->metadata() != project->metadata()) {
......@@ -2086,7 +2086,7 @@ void MainWindow::slotEditProjectSettings()
void MainWindow::slotDisableProxies()
{
pCore->currentDoc()->setDocumentProperty(QStringLiteral("enableproxy"), QString::number((int)false));
pCore->currentDoc()->setDocumentProperty(QStringLiteral("enableproxy"), QString::number(false));
pCore->currentDoc()->setModified();
slotUpdateProxySettings();
}
......@@ -2475,7 +2475,7 @@ void MainWindow::slotCheckTabPosition()
{
int pos = tabPosition(Qt::LeftDockWidgetArea);
if (KdenliveSettings::tabposition() != pos) {
setTabPosition(Qt::AllDockWidgetAreas, (QTabWidget::TabPosition)KdenliveSettings::tabposition());
setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::TabPosition(KdenliveSettings::tabposition()));
}
}
......@@ -3960,7 +3960,7 @@ void MainWindow::configureToolbars()
// Since our timeline toolbar is a non-standard toolbar (as it is docked in a custom widget, not
// in a QToolBarDockArea, we have to hack KXmlGuiWindow to avoid a crash when saving toolbar config.
// This is why we hijack the configureToolbars() and temporarily move the toolbar to a standard location
auto *ctnLay = (QVBoxLayout *)m_timelineToolBarContainer->layout();
auto *ctnLay = static_cast<QVBoxLayout *>(m_timelineToolBarContainer->layout());
ctnLay->removeWidget(m_timelineToolBar);
addToolBar(Qt::BottomToolBarArea, m_timelineToolBar);
auto *toolBarEditor = new KEditToolBar(guiFactory(), this);
......@@ -3976,7 +3976,7 @@ void MainWindow::rebuildTimlineToolBar()
m_timelineToolBar = toolBar(QStringLiteral("timelineToolBar"));
removeToolBar(m_timelineToolBar);
m_timelineToolBar->setToolButtonStyle(Qt::ToolButtonIconOnly);
auto *ctnLay = (QVBoxLayout *)m_timelineToolBarContainer->layout();
auto *ctnLay = static_cast<QVBoxLayout *>(m_timelineToolBarContainer->layout());
if (ctnLay) {
ctnLay->insertWidget(0, m_timelineToolBar);
}
......
......@@ -21,7 +21,7 @@
#include <QPainter>
#include <QElapsedTimer>
#include <cmath>
const float P75 = .75;
const double P75 = .75;
const QPointF YUV_R(-.147, .615);
const QPointF YUV_G(-.289, -.515);
......@@ -278,7 +278,7 @@ QImage Vectorscope::renderGfxScope(uint accelerationFactor, const QImage &qimage
VectorscopeGenerator::ColorSpace colorSpace =
m_aColorSpace_YPbPr->isChecked() ? VectorscopeGenerator::ColorSpace_YPbPr : VectorscopeGenerator::ColorSpace_YUV;
VectorscopeGenerator::PaintMode paintMode = (VectorscopeGenerator::PaintMode)m_ui->paintMode->itemData(m_ui->paintMode->currentIndex()).toInt();
VectorscopeGenerator::PaintMode paintMode = VectorscopeGenerator::PaintMode(m_ui->paintMode->itemData(m_ui->paintMode->currentIndex()).toInt());
scope = m_vectorscopeGenerator->calculateVectorscope(m_scopeRect.size(), qimage, m_gain, paintMode, colorSpace, m_aAxisEnabled->isChecked(),
accelerationFactor);
}
......
......@@ -471,7 +471,7 @@ void ClipModel::refreshProducerFromBin(int trackId, PlaylistState::ClipState sta
int in = getIn();
int out = getOut();
if (!qFuzzyCompare(speed, m_speed) && !qFuzzyIsNull(speed)) {
in = in * std::abs(m_speed / speed);
in = int(in * std::abs(m_speed / speed));
out = in + getPlaytime() - 1;
// prevent going out of the clip's range
out = std::min(out, int(double(m_producer->get_length()) * std::abs(m_speed / speed)) - 1);
......@@ -658,7 +658,7 @@ bool ClipModel::showKeyframes() const
void ClipModel::setShowKeyframes(bool show)
{
QWriteLocker locker(&m_lock);
service()->set("kdenlive:hide_keyframes", (int)!show);
service()->set("kdenlive:hide_keyframes", !show);
}
void ClipModel::setPosition(int pos)
......@@ -835,7 +835,7 @@ QDomElement ClipModel::toXml(QDomDocument &document)
container.setAttribute(QStringLiteral("in"), getIn());
container.setAttribute(QStringLiteral("out"), getOut());
container.setAttribute(QStringLiteral("position"), getPosition());
container.setAttribute(QStringLiteral("state"), (int)m_currentState);
container.setAttribute(QStringLiteral("state"), m_currentState);
if (auto ptr = m_parent.lock()) {
int trackId = ptr->getTrackPosition(m_currentTrackId);
container.setAttribute(QStringLiteral("track"), trackId);
......
......@@ -247,7 +247,7 @@ bool CompositionModel::showKeyframes() const
void CompositionModel::setShowKeyframes(bool show)
{
QWriteLocker locker(&m_lock);
service()->set("kdenlive:hide_keyframes", (int)!show);
service()->set("kdenlive:hide_keyframes", !show);
}
const QString &CompositionModel::displayName() const
......
......@@ -98,7 +98,7 @@ QModelIndex TimelineItemModel::index(int row, int column, const QModelIndex &par
// Invalid index requested
Q_ASSERT(false);
}
} else if (row < (int)m_allTracks.size() && row >= 0) {
} else if (row < int(m_allTracks.size()) && row >= 0) {
// Get sort order
// row = getTracksCount() - 1 - row;
auto it = m_allTracks.cbegin();
......@@ -146,7 +146,7 @@ QModelIndex TimelineItemModel::makeTrackIndexFromID(int trackId) const
// we retrieve iterator
Q_ASSERT(m_iteratorTable.count(trackId) > 0);
auto it = m_iteratorTable.at(trackId);
int ind = (int)std::distance<decltype(m_allTracks.cbegin())>(m_allTracks.begin(), it);
int ind = int(std::distance<decltype(m_allTracks.cbegin())>(m_allTracks.begin(), it));
// Get sort order
// ind = getTracksCount() - 1 - ind;
return index(ind);
......@@ -178,7 +178,7 @@ int TimelineItemModel::rowCount(const QModelIndex &parent) const
{
READ_LOCK();
if (parent.isValid()) {
const int id = (int)parent.internalId();
const int id = int(parent.internalId());
if (!isTrack(id)) {
// clips don't have children
// if it is not a track, it is something invalid
......@@ -186,7 +186,7 @@ int TimelineItemModel::rowCount(const QModelIndex &parent) const
}
return getTrackClipsCount(id) + getTrackCompositionsCount(id);
}
return (int)m_allTracks.size();
return int(m_allTracks.size());
}
int TimelineItemModel::columnCount(const QModelIndex &parent) const
......@@ -260,7 +260,7 @@ QVariant TimelineItemModel::data(const QModelIndex &index, int role) const
// qDebug() << "DATA abort. Index validity="<<index.isValid();
return QVariant();
}
const int id = (int)index.internalId();
const int id = int(index.internalId());
if (role == ItemIdRole) {
return id;
}
......@@ -647,7 +647,7 @@ void TimelineItemModel::buildTrackCompositing(bool rebuild)
if (rebuild) {
while (service != nullptr && service->is_valid()) {
if (service->type() == transition_type) {
Mlt::Transition t((mlt_transition)service->get_service());
Mlt::Transition t(mlt_transition(service->get_service()));
service.reset(service->producer());
if (t.get_int("internal_added") == 237) {
// remove all compositing transitions
......
......@@ -3917,9 +3917,9 @@ int TimelineModel::getNextSnapPos(int pos, std::vector<int> &snaps)
filterOutSubtitles = true;
}
}
if ((tracks.isEmpty() || tracks.count() == (int) m_allTracks.size()) && !filterOutSubtitles) {
if ((tracks.isEmpty() || tracks.count() == int(m_allTracks.size())) && !filterOutSubtitles) {
// No active track, use all possible snap points
return m_snaps->getNextPoint((int)pos);
return m_snaps->getNextPoint(pos);
}
// Build snap points for selected tracks
for (const auto &cp : m_allClips) {
......@@ -4303,7 +4303,7 @@ bool TimelineModel::replantCompositions(int currentCompo, bool updateView)
mlt_service_type mlt_type = mlt_service_identify(nextservice);
QList<Mlt::Transition *> trackCompositions;
while (mlt_type == transition_type) {
Mlt::Transition transition((mlt_transition)nextservice);
Mlt::Transition transition(reinterpret_cast<mlt_transition>(nextservice));
nextservice = mlt_service_producer(nextservice);
int internal = transition.get_int("internal_added");
if (internal > 0 && resource != QLatin1String("mix")) {
......
......@@ -131,7 +131,7 @@ int TrackModel::getClipsCount()
}
Q_ASSERT(count == static_cast<int>(m_allClips.size()));
#else
int count = (int)m_allClips.size();
int count = int(m_allClips.size());
#endif
return count;
}
......@@ -834,7 +834,7 @@ int TrackModel::getRowfromClip(int clipId) const
{
READ_LOCK();
Q_ASSERT(m_allClips.count(clipId) > 0);
return (int)std::distance(m_allClips.begin(), m_allClips.find(clipId));
return int(std::distance(m_allClips.begin(), m_allClips.find(clipId)));
}
std::unordered_set<int> TrackModel::getCompositionsInRange(int position, int end)
......@@ -860,7 +860,7 @@ int TrackModel::getRowfromComposition(int tid) const
{
READ_LOCK();
Q_ASSERT(m_allCompositions.count(tid) > 0);
return (int)m_allClips.size() + (int)std::distance(m_allCompositions.begin(), m_allCompositions.find(tid));
return int(m_allClips.size()) + int(std::distance(m_allCompositions.begin(), m_allCompositions.find(tid)));
}
QVariant TrackModel::getProperty(const QString &name) const
......@@ -958,41 +958,41 @@ bool TrackModel::checkConsistency()
// the previous clip on the same playlist must not intersect
int prev_clip_id_same_playlist = -1;
for (int j = (int)i - 1; j >= 0; --j) {
if (cur_playlist == m_allClips[clips[(size_t)j].second]->getSubPlaylistIndex()) {
for (int j = int(i) - 1; j >= 0; --j) {
if (cur_playlist == m_allClips[clips[size_t(j)].second]->getSubPlaylistIndex()) {
prev_clip_id_same_playlist = j;
break;
}
}
if (prev_clip_id_same_playlist >= 0 &&
clips[(size_t)prev_clip_id_same_playlist].first + m_allClips[clips[(size_t)prev_clip_id_same_playlist].second]->getPlaytime() > clips[i].first) {
clips[size_t(prev_clip_id_same_playlist)].first + m_allClips[clips[size_t(prev_clip_id_same_playlist)].second]->getPlaytime() > clips[i].first) {
qDebug() << "ERROR: found overlapping clips at position " << clips[i].first;
return false;
}
// the previous clip on the other playlist might restrict the blank in/out
int prev_clip_id_other_playlist = -1;
for (int j = (int)i - 1; j >= 0; --j) {
if (other_playlist == m_allClips[clips[(size_t)j].second]->getSubPlaylistIndex()) {
for (int j = int(i) - 1; j >= 0; --j) {
if (other_playlist == m_allClips[clips[size_t(j)].second]->getSubPlaylistIndex()) {
prev_clip_id_other_playlist = j;
break;
}
}
if (prev_clip_id_other_playlist >= 0) {
in_blank = std::max(in_blank, clips[(size_t)prev_clip_id_other_playlist].first +
m_allClips[clips[(size_t)prev_clip_id_other_playlist].second]->getPlaytime());
in_blank = std::max(in_blank, clips[size_t(prev_clip_id_other_playlist)].first +
m_allClips[clips[size_t(prev_clip_id_other_playlist)].second]->getPlaytime());
}
// the next clip on the other playlist might restrict the blank in/out
int next_clip_id_other_playlist = -1;
for (int j = (int)i + 1; j < (int)clips.size(); ++j) {
if (other_playlist == m_allClips[clips[(size_t)j].second]->getSubPlaylistIndex()) {
next_clip_id_other_playlist = j;
for (size_t j = i + 1; j < clips.size(); ++j) {
if (other_playlist == m_allClips[clips[j].second]->getSubPlaylistIndex()) {
next_clip_id_other_playlist = int(j);
break;
}
}
if (next_clip_id_other_playlist >= 0) {
out_blank = std::min(out_blank, clips[(size_t)next_clip_id_other_playlist].first - 1);
out_blank = std::min(out_blank, clips[size_t(next_clip_id_other_playlist)].first - 1);
}
if (in_blank <= out_blank && !check_blank_zone(other_playlist, in_blank, out_blank)) {
qDebug() << "ERROR: we expected blank on playlist " << other_playlist << " between " << in_blank << " and " << out_blank;
......@@ -1047,7 +1047,7 @@ bool TrackModel::checkConsistency()
qDebug()<<"=== STARTING MIX CHECK ======";
while (service != nullptr && service->is_valid()) {
if (service->type() == transition_type) {
Mlt::Transition t((mlt_transition)service->get_service());
Mlt::Transition t(mlt_transition(service->get_service()));
service.reset(service->producer());
// Check that the mix has correct in/out
int mainId = -1;
......@@ -1328,19 +1328,19 @@ Fun TrackModel::requestCompositionDeletion_lambda(int compoId, bool updateView,
int TrackModel::getCompositionByRow(int row) const
{
READ_LOCK();
if (row < (int)m_allClips.size()) {
if (row < int(m_allClips.size())) {
return -1;
}
Q_ASSERT(row <= (int)m_allClips.size() + (int)m_allCompositions.size());
Q_ASSERT(row <= int(m_allClips.size() + m_allCompositions.size()));
auto it = m_allCompositions.cbegin();
std::advance(it, row - (int)m_allClips.size());
std::advance(it, row - int(m_allClips.size()));
return (*it).first;
}
int TrackModel::getCompositionsCount() const
{
READ_LOCK();
return (int)m_allCompositions.size();
return int(m_allCompositions.size());
}
Fun TrackModel::requestCompositionInsertion_lambda(int compoId, int position, bool updateView, bool finalMove)
......@@ -1498,7 +1498,7 @@ void TrackModel::lock()
}
void TrackModel::unlock()
{
setProperty(QStringLiteral("kdenlive:locked_track"), (char *)nullptr);
setProperty(QStringLiteral("kdenlive:locked_track"), nullptr);
if (auto ptr = m_parent.lock()) {
QModelIndex ix = ptr->makeTrackIndexFromID(m_id);
emit ptr->dataChanged(ix, ix, {TimelineModel::IsLockedRole});
......@@ -2176,7 +2176,7 @@ void TrackModel::syncronizeMixes(bool finalMove)
int TrackModel::mixCount() const
{
Q_ASSERT(m_mixList.size() == (int) m_sameCompositions.size());
Q_ASSERT(m_mixList.size() == int(m_sameCompositions.size()));
return m_mixList.size();
}
......
......@@ -52,7 +52,7 @@ SpeedDialog::SpeedDialog(QWidget *parent, double speed, int duration, double min
ui->checkBox->setChecked(true);
}
ui->speedSpin->setValue(speed);
ui->speedSlider->setValue(qLn(speed) * 12);
ui->speedSlider->setValue(int(qLn(speed) * 12));
ui->pitchCompensate->setChecked(pitch_compensate);
if (!EffectsRepository::get()->exists(QStringLiteral("rbpitch"))) {
ui->pitchCompensate->setEnabled(false);
......@@ -75,12 +75,12 @@ SpeedDialog::SpeedDialog(QWidget *parent, double speed, int duration, double min
value = 1;
m_durationDisplay->setValue(value);
} else if (value > m_duration * speed / minSpeed) {
value = m_duration * speed / minSpeed;
value = int(m_duration * speed / minSpeed);
m_durationDisplay->setValue(value);
}
double updatedSpeed = speed * m_duration / value;
QSignalBlocker bk(ui->speedSlider);
ui->speedSlider->setValue(qLn(updatedSpeed) * 12);
ui->speedSlider->setValue(int(qLn(updatedSpeed) * 12));
QSignalBlocker bk2(ui->speedSpin);
ui->speedSpin->setValue(updatedSpeed);
checkSpeed(infoMessage, updatedSpeed);
......@@ -90,7 +90,7 @@ SpeedDialog::SpeedDialog(QWidget *parent, double speed, int duration, double min
connect(ui->speedSpin, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), this, [&, speed] (double value) {
QSignalBlocker bk(ui->speedSlider);
ui->speedSlider->setValue(qLn(value) * 12);
ui->speedSlider->setValue(int(qLn(value) * 12));
if (m_durationDisplay) {
QSignalBlocker bk2(m_durationDisplay);
int dur = qRound(m_duration * std::fabs(speed / value));
......
......@@ -419,7 +419,7 @@ void TimelineWidget::zoneUpdatedWithUndo(const QPoint &oldZone, const QPoint &ne
void TimelineWidget::setTool(ProjectTool tool)
{
rootObject()->setProperty("activeTool", (int)tool);
rootObject()->setProperty("activeTool", int(tool));
}
QPair<int, int> TimelineWidget::getTracksCount() const
......@@ -442,7 +442,7 @@ void TimelineWidget::slotUngrabHack()
int TimelineWidget::zoomForScale(double value) const
{
int scale = 100.0 / value;
int scale = int(100 / value);
int ix = 13;
while (comboScale[ix] > scale && ix > 0) {
ix--;
......
......@@ -89,7 +89,7 @@ bool MltPreview::create(const QString &path, int width, int height, QImage &img)
// img = getFrame(producer, frame, width, height);
while (variance <= 40 && ct < 4) {
img = getFrame(producer, frame, wanted_width, wanted_height);
variance = imageVariance(img);
variance = uint(imageVariance(img));
frame += 100 * ct;
ct++;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment