Commit 89101ae1 authored by Nicolas Carion's avatar Nicolas Carion

linting

parent 7be20047
......@@ -412,7 +412,7 @@ public:
// QRect r = QStyle::alignedRect(opt.direction, Qt::AlignVCenter | Qt::AlignLeft, opt.decorationSize, r1);
style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, opt.widget);
if (option.state & QStyle::State_Selected != 0) {
if ((option.state & static_cast<int>((QStyle::State_Selected) != 0)) != 0) {
painter->setPen(option.palette.highlightedText().color());
} else {
painter->setPen(option.palette.text().color());
......@@ -473,7 +473,8 @@ public:
painter->setBrush(Qt::darkGray);
if (jobProgress > 0) {
painter->drawRoundedRect(progress, 2, 2);
painter->setBrush(option.state & QStyle::State_Selected != 0 ? option.palette.text() : option.palette.highlight());
painter->setBrush((option.state & static_cast<int>((QStyle::State_Selected) != 0)) != 0 ? option.palette.text()
: option.palette.highlight());
progress.setWidth((progressWidth - 2) * jobProgress / 100);
painter->drawRoundedRect(progress, 2, 2);
} else if (jobProgress == JobWaiting) {
......
......@@ -1176,11 +1176,9 @@ QStringList ProjectClip::updatedAnalysisData(const QString &name, const QString
}
return QStringList() << QString("kdenlive:clipanalysis." + name + QString::number(i)) << geometryWithOffset(data, offset);
// m_controller->setProperty("kdenlive:clipanalysis." + name + QLatin1Char(' ') + QString::number(i), geometryWithOffset(data, offset));
} else {
return QStringList() << QString("kdenlive:clipanalysis." + name) << geometryWithOffset(data, offset);
// m_controller->setProperty("kdenlive:clipanalysis." + name, geometryWithOffset(data, offset));
}
return QStringList() << QString("kdenlive:clipanalysis." + name) << geometryWithOffset(data, offset);
// m_controller->setProperty("kdenlive:clipanalysis." + name, geometryWithOffset(data, offset));
}
QMap<QString, QString> ProjectClip::analysisData(bool withPrefix)
......
......@@ -176,7 +176,6 @@ void Core::initGUI(const QUrl &Url)
m_mainWindow->show();
}
std::unique_ptr<Core> &Core::self()
{
if (!m_self) {
......
......@@ -97,11 +97,11 @@ QString ScriptGetVar(const QString varName)
}
#else
const QLatin1String ScriptFormat(".sh");
QString ScriptSetVar(const QString name, const QString value)
QString ScriptSetVar(const QString &name, const QString &value)
{
return name + "=\"" + value + '\"';
}
QString ScriptGetVar(const QString varName)
QString ScriptGetVar(const QString &varName)
{
return QString('$') + varName;
}
......
......@@ -442,7 +442,7 @@ QMimeData *EffectsListWidget::mimeData(const QList<QTreeWidgetItem *> list) cons
QDomDocument doc;
bool transitionMode = false;
for (QTreeWidgetItem *item : list) {
if (item->flags() & Qt::ItemIsDragEnabled) {
if (item->flags() & Qt::ItemIsDragEnabled != 0) {
int type = item->data(0, TypeRole).toInt();
if (type == EffectsList::TRANSITION_TYPE) {
transitionMode = true;
......
......@@ -208,7 +208,7 @@ void MyTextItem::updateGeometry(int, int, int)
void MyTextItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *w)
{
if (textInteractionFlags() & Qt::TextEditable != 0) {
if ((textInteractionFlags() & static_cast<int>((Qt::TextEditable) != 0)) != 0) {
QGraphicsTextItem::paint(painter, option, w);
} else {
painter->setRenderHint(QPainter::Antialiasing);
......@@ -335,7 +335,7 @@ void MyTextItem::updateGeometry()
setAlignment(m_alignment);
QPointF topRight = boundingRect().topRight();
if (m_alignment & Qt::AlignRight != 0) {
if ((m_alignment & static_cast<int>((Qt::AlignRight) != 0)) != 0) {
setPos(pos() + (topRightPrev - topRight));
}
}
......@@ -543,7 +543,7 @@ void GraphicsSceneRectMove::keyPressEvent(QKeyEvent *keyEvent)
}
if (m_selectedItem->type() == QGraphicsTextItem::Type) {
MyTextItem *t = static_cast<MyTextItem *>(m_selectedItem);
if (t->textInteractionFlags() & Qt::TextEditorInteraction != 0) {
if ((t->textInteractionFlags() & static_cast<int>((Qt::TextEditorInteraction) != 0)) != 0) {
QGraphicsScene::keyPressEvent(keyEvent);
return;
}
......@@ -614,7 +614,7 @@ void GraphicsSceneRectMove::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *e)
g = i.at(ix);
ix++;
}
if ((g != nullptr) && g->type() == QGraphicsTextItem::Type && (g->flags() & QGraphicsItem::ItemIsSelectable != 0)) {
if ((g != nullptr) && g->type() == QGraphicsTextItem::Type && (((g->flags() & static_cast<int>((QGraphicsItem::ItemIsSelectable) != 0))) != 0)) {
m_selectedItem = g;
} else {
emit doubleClickEvent();
......@@ -869,7 +869,7 @@ void GraphicsSceneRectMove::mouseMoveEvent(QGraphicsSceneMouseEvent *e)
QGraphicsScene::mouseMoveEvent(e);
} else if (m_selectedItem->type() == QGraphicsTextItem::Type) {
MyTextItem *t = static_cast<MyTextItem *>(m_selectedItem);
if (t->textInteractionFlags() & Qt::TextEditorInteraction != 0) {
if ((t->textInteractionFlags() & static_cast<int>((Qt::TextEditorInteraction) != 0)) != 0) {
QGraphicsScene::mouseMoveEvent(e);
return;
}
......
......@@ -512,7 +512,7 @@ void AnimationWidget::slotPositionChanged(int pos, bool seek)
m_next->setEnabled(pos < (m_outPoint - m_inPoint - 1));
// scene ratio lock
if (m_spinWidth && m_spinWidth->isEnabled()) {
if ((m_spinWidth != nullptr) && m_spinWidth->isEnabled()) {
double ratio = m_originalSize->isChecked() ? (double)m_frameSize.x() / m_frameSize.y()
: (double)m_monitor->render->frameRenderWidth() / m_monitor->render->renderHeight();
bool lockRatio = m_spinHeight->value() == (int)(m_spinWidth->value() / ratio + 0.5);
......@@ -812,7 +812,7 @@ void AnimationWidget::buildRectWidget(const QString &paramTag, const QDomElement
m_lockRatio = new QAction(KoIconUtils::themedIcon(QStringLiteral("link")), i18n("Lock aspect ratio"), this);
m_lockRatio->setCheckable(true);
connect(m_lockRatio, &QAction::triggered, this, &AnimationWidget::slotLockRatio);
QToolButton *ratioButton = new QToolButton;
auto *ratioButton = new QToolButton;
ratioButton->setDefaultAction(m_lockRatio);
horLayout->addWidget(ratioButton);
......
......@@ -249,9 +249,8 @@ QColor ColorPickerWidget::grabColor(const QPoint &p, bool destroyImage)
return i.pixel(0, 0);
}
return qRgb(0, 0, 0);
} else {
return m_image.pixel(p.x(), p.y());
}
return m_image.pixel(p.x(), p.y());
#endif
}
......@@ -101,7 +101,7 @@ GeometryWidget::GeometryWidget(EffectMetaInfo *info, int clipPos, bool showRotat
m_lockRatio = new QAction(KoIconUtils::themedIcon(QStringLiteral("link")), i18n("Lock aspect ratio"), this);
m_lockRatio->setCheckable(true);
connect(m_lockRatio, &QAction::triggered, this, &GeometryWidget::slotLockRatio);
QToolButton *ratioButton = new QToolButton;
auto *ratioButton = new QToolButton;
ratioButton->setDefaultAction(m_lockRatio);
m_ui.horizontalLayout->addWidget(ratioButton, 0, 3);
......
......@@ -72,7 +72,7 @@ QMimeData *AnalysisTree::mimeData(const QList<QTreeWidgetItem *> list) const
{
QString data;
for (QTreeWidgetItem *item : list) {
if (item->flags() & Qt::ItemIsDragEnabled) {
if (item->flags() & Qt::ItemIsDragEnabled != 0) {
data.append(item->text(1));
}
}
......
......@@ -71,7 +71,8 @@ rectActions OnMonitorRectItem::getMode(const QPointF &pos)
}
if (mouseArea.contains(pol.at(2))) {
return ResizeBottomRight;
} else if (mouseArea.contains(pol.at(1))) {
}
if (mouseArea.contains(pol.at(1))) {
return ResizeTopRight;
} else if (mouseArea.contains(pol.at(3))) {
return ResizeBottomLeft;
......
......@@ -202,7 +202,8 @@ QHash<ProjectClip *, AbstractClipJob *> FilterJob::prepareJob(const QList<Projec
jobs.insert(clip, job);
}
return jobs;
} else if (filterName == QLatin1String("vidstab") || filterName == QLatin1String("videostab2") || filterName == QLatin1String("videostab")) {
}
if (filterName == QLatin1String("vidstab") || filterName == QLatin1String("videostab2") || filterName == QLatin1String("videostab")) {
// vidstab
int out = 100000;
if (clips.count() == 1) {
......
......@@ -242,7 +242,8 @@ QList<ProjectClip *> JobManager::filterClips(const QList<ProjectClip *> &clips,
}
if (jobType == AbstractClipJob::FILTERCLIPJOB) {
return FilterJob::filterClips(clips, params);
} else if (jobType == AbstractClipJob::PROXYJOB) {
}
if (jobType == AbstractClipJob::PROXYJOB) {
return ProxyJob::filterClips(clips);
}
return QList<ProjectClip *>();
......
......@@ -886,4 +886,3 @@ void ProjectManager::updateTimeline(Mlt::Tractor tractor)
pCore->window()->getMainTimeline()->setModel(m_mainTimelineModel);
m_mainTimelineModel->setUndoStack(m_project->commandStack());
}
......@@ -1027,7 +1027,8 @@ OperationType ClipItem::operationMode(const QPointF &pos, Qt::KeyboardModifiers
}
}
return ResizeStart;
} else if (qAbs((int)(pos.x() - (rect.width() - m_endFade))) < maximumOffset && qAbs((int)(pos.y())) < 10) {
}
if (qAbs((int)(pos.x() - (rect.width() - m_endFade))) < maximumOffset && qAbs((int)(pos.y())) < 10) {
return FadeOut;
} else if ((pos.x() >= rect.width() / 2) && (rect.width() - pos.x() < maximumOffset) && (rect.height() - pos.y() > addtransitionOffset)) {
if ((modifiers & Qt::ControlModifier) != 0u) {
......
......@@ -395,7 +395,7 @@ bool CustomTrackView::checkTrackHeight(bool force)
}
setSceneRect(0, 0, sceneRect().width(), m_tracksHeight * m_timeline->visibleTracksCount());
double newHeight = m_tracksHeight * m_timeline->visibleTracksCount() * matrix().m22();
if (m_cursorLine->flags() & QGraphicsItem::ItemIgnoresTransformations != 0) {
if ((m_cursorLine->flags() & static_cast<int>((QGraphicsItem::ItemIgnoresTransformations) != 0)) != 0) {
m_cursorLine->setLine(0, 0, 0, newHeight - 1);
} else {
m_cursorLine->setLine(0, 0, 0, m_tracksHeight * m_timeline->visibleTracksCount() - 1);
......@@ -3794,7 +3794,7 @@ void CustomTrackView::reloadTimeline()
for (int i = 0; i < m_guides.count(); ++i) {
m_guides.at(i)->setLine(0, 0, 0, maxHeight - 1);
}
if (m_cursorLine->flags() & QGraphicsItem::ItemIgnoresTransformations != 0) {
if ((m_cursorLine->flags() & static_cast<int>((QGraphicsItem::ItemIgnoresTransformations) != 0)) != 0) {
m_cursorLine->setLine(0, 0, 0, maxHeight - 1);
} else {
m_cursorLine->setLine(0, 0, 0, m_tracksHeight * m_timeline->visibleTracksCount() - 1);
......
......@@ -105,7 +105,8 @@ bool SelectManager::mouseMove(QMouseEvent *event, int, int)
static_cast<ClipItem *>(dragItem)->setFadeOut(static_cast<int>(dragItem->endPos().frames(m_view->fps()) - mappedXPos));
event->accept();
return true;
} else if (mode == KeyFrame) {
}
if (mode == KeyFrame) {
AbstractClipItem *dragItem = m_view->dragItem();
double mappedXPos = m_view->mapToScene(event->pos()).x();
GenTime keyFramePos = GenTime(mappedXPos, m_view->fps()) - dragItem->startPos();
......
......@@ -117,7 +117,8 @@ QModelIndex TimelineItemModel::parent(const QModelIndex &index) const
if (isClip(id)) {
const int trackId = getClipTrackId(id);
return makeTrackIndexFromID(trackId);
} else if (isComposition(id)) {
}
if (isComposition(id)) {
const int trackId = getCompositionTrackId(id);
return makeTrackIndexFromID(trackId);
}
......
......@@ -195,7 +195,7 @@ private:
int m_currentInsertionOrder;
std::map<int, std::shared_ptr<ClipModel>> m_allClips; /*this is important to keep an
ordered structure to store the clips, since we use their ids order as row order*/
ordered structure to store the clips, since we use their ids order as row order*/
std::map<int, std::shared_ptr<CompositionModel>>
m_allCompositions; /*this is important to keep an
ordered structure to store the clips, since we use their ids order as row order*/
......
......@@ -77,7 +77,7 @@ TimelineWidget::TimelineWidget(KActionCollection *actionCollection, std::shared_
void TimelineWidget::setModel(std::shared_ptr<TimelineItemModel> model)
{
m_thumbnailer->resetProject();
m_model = model;
m_model = std::move(model);
auto *proxyModel = new QSortFilterProxyModel(this);
proxyModel->setSourceModel(m_model.get());
......@@ -280,14 +280,12 @@ void TimelineWidget::onSeeked(int position)
}
}
void TimelineWidget::mousePressEvent(QMouseEvent *event)
{
emit focusProjectMonitor();
QQuickWidget::mousePressEvent(event);
}
void TimelineWidget::slotChangeZoom(int value, bool zoomOnMouse)
{
setScaleFactor(100.0 / comboScale[value]);
......
......@@ -184,7 +184,6 @@ int FlowLayout::smartSpacing(QStyle::PixelMetric pm) const
if (parent->isWidgetType()) {
QWidget *pw = static_cast<QWidget *>(parent);
return pw->style()->pixelMetric(pm, nullptr, pw);
} else {
return static_cast<QLayout *>(parent)->spacing();
}
return static_cast<QLayout *>(parent)->spacing();
}
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