Commit 058d8923 authored by Nicolas Carion's avatar Nicolas Carion
Browse files

some clang-tidy

parent c18f8113
Pipeline #1573 passed with stage
in 20 minutes and 16 seconds
......@@ -69,7 +69,7 @@ protected:
QString id; // identifier of the asset
QString mltId; //"tag" of the asset, that is the name of the mlt service
QString name, description, author, version_str;
int version;
int version{};
QDomElement xml;
AssetType type;
};
......@@ -85,7 +85,7 @@ protected:
@param res Datastructure to fill
@return true on success
*/
bool parseInfoFromMlt(const QString &effectId, Info &res);
bool parseInfoFromMlt(const QString &assetId, Info &res);
/* @brief Returns the metadata associated with the given asset*/
virtual Mlt::Properties *getMetadata(const QString &assetId) = 0;
......
......@@ -155,7 +155,7 @@ template <typename AssetType> bool AbstractAssetsRepository<AssetType>::parseInf
continue;
}
if (paramdesc.get("readonly") && !strcmp(paramdesc.get("readonly"), "yes")) {
if (paramdesc.get("readonly") && (strcmp(paramdesc.get("readonly"), "yes") == 0)) {
// Do not expose readonly parameters
continue;
}
......
......@@ -142,7 +142,7 @@ void AssetParameterModel::prepareKeyframes()
}
}
void AssetParameterModel::setParameter(const QString &name, const int value, bool update)
void AssetParameterModel::setParameter(const QString &name, int value, bool update)
{
Q_ASSERT(m_asset->is_valid());
m_asset->set(name.toLatin1().constData(), value);
......@@ -481,7 +481,7 @@ QString AssetParameterModel::getDefaultKeyframes(int start, const QString &defau
}
// static
QVariant AssetParameterModel::parseAttribute(const ObjectId owner, const QString &attribute, const QDomElement &element, QVariant defaultValue)
QVariant AssetParameterModel::parseAttribute(const ObjectId &owner, const QString &attribute, const QDomElement &element, QVariant defaultValue)
{
if (!element.hasAttribute(attribute) && !defaultValue.isNull()) {
return defaultValue;
......@@ -778,7 +778,7 @@ ObjectId AssetParameterModel::getOwnerId() const
return m_ownerId;
}
void AssetParameterModel::addKeyframeParam(const QModelIndex index)
void AssetParameterModel::addKeyframeParam(const QModelIndex &index)
{
if (m_keyframes) {
m_keyframes->addParameter(index);
......
......@@ -127,7 +127,7 @@ public:
/* @brief Set the parameter with given name to the given value
*/
Q_INVOKABLE void setParameter(const QString &name, const QString &paramValue, bool update = true, const QModelIndex &paramIndex = QModelIndex());
void setParameter(const QString &name, const int value, bool update = true);
void setParameter(const QString &name, int value, bool update = true);
Q_INVOKABLE void setParameter(const QString &name, double &value);
/* @brief Return all the parameters as pairs (parameter name, parameter value) */
......@@ -178,12 +178,12 @@ protected:
- %width and %height that are replaced with profile's height and width.
If keywords are found, mathematical operations are supported for double type params. For example "%width -1" is a valid value.
*/
static QVariant parseAttribute(const ObjectId owner, const QString &attribute, const QDomElement &element, QVariant defaultValue = QVariant());
static QVariant parseAttribute(const ObjectId &owner, const QString &attribute, const QDomElement &element, QVariant defaultValue = QVariant());
/* @brief Helper function to register one more parameter that is keyframable.
@param index is the index corresponding to this parameter
*/
void addKeyframeParam(const QModelIndex index);
void addKeyframeParam(const QModelIndex &index);
struct ParamRow
{
......
......@@ -509,7 +509,7 @@ void SmallJobLabel::slotTimeLineFinished()
void SmallJobLabel::slotSetJobCount(int jobCount)
{
QMutexLocker lk(&locker);
QMutexLocker lk(&m_locker);
if (jobCount > 0) {
// prepare animation
setText(i18np("%1 job", "%1 jobs", jobCount));
......@@ -1558,7 +1558,7 @@ void Bin::contextMenuEvent(QContextMenuEvent *event)
}
}
void Bin::slotItemDoubleClicked(const QModelIndex &ix, const QPoint pos)
void Bin::slotItemDoubleClicked(const QModelIndex &ix, const QPoint &pos)
{
std::shared_ptr<AbstractProjectItem> item = m_itemModel->getBinItemByIndex(m_proxyModel->mapToSource(ix));
if (m_listType == BinIconView) {
......
......@@ -123,7 +123,7 @@ private:
QTimeLine *m_timeLine;
QAction *m_action{nullptr};
QMutex locker;
QMutex m_locker;
public slots:
void slotSetJobCount(int jobCount);
......@@ -320,7 +320,7 @@ public slots:
/** @brief Reload clip thumbnail - when frame for thumbnail changed */
void slotRefreshClipThumbnail(const QString &id);
void slotDeleteClip();
void slotItemDoubleClicked(const QModelIndex &ix, const QPoint pos);
void slotItemDoubleClicked(const QModelIndex &ix, const QPoint &pos);
void slotSwitchClipProperties(const std::shared_ptr<ProjectClip> &clip);
void slotSwitchClipProperties();
/** @brief Creates a new folder with optional name, and returns new folder's id */
......
......@@ -202,7 +202,7 @@ public:
void addEffect(const QString &effectId);
protected:
virtual void emitProducerChanged(const QString &, const std::shared_ptr<Mlt::Producer> &){};
virtual void emitProducerChanged(const QString & /*unused*/, const std::shared_ptr<Mlt::Producer> & /*unused*/){};
virtual void connectEffectStack(){};
// This is the helper function that checks if the clip has audio and video and stores the result
......
......@@ -132,7 +132,7 @@ bool TimelineFunctions::requestClipCut(std::shared_ptr<TimelineItemModel> timeli
{
std::function<bool(void)> undo = []() { return true; };
std::function<bool(void)> redo = []() { return true; };
bool result = TimelineFunctions::requestClipCut(std::move(timeline), clipId, position, undo, redo);
bool result = TimelineFunctions::requestClipCut(timeline, clipId, position, undo, redo);
if (result) {
pCore->pushUndo(undo, redo, i18n("Cut clip"));
}
......@@ -175,7 +175,8 @@ bool TimelineFunctions::requestClipCut(const std::shared_ptr<TimelineItemModel>
bool undone = undo();
Q_ASSERT(undone);
return false;
} else if (cid == clipId) {
}
if (cid == clipId) {
mainId = newId;
}
// splitted elements go temporarily in the same group as original ones.
......@@ -188,7 +189,7 @@ bool TimelineFunctions::requestClipCut(const std::shared_ptr<TimelineItemModel>
auto criterion = [timeline, position](int cid) { return timeline->getClipPosition(cid) < position; };
bool res = true;
for (const int topId : topElements) {
res = res & timeline->m_groups->split(topId, criterion, undo, redo);
res = res && timeline->m_groups->split(topId, criterion, undo, redo);
}
if (!res) {
bool undone = undo();
......@@ -202,7 +203,7 @@ bool TimelineFunctions::requestClipCut(const std::shared_ptr<TimelineItemModel>
int TimelineFunctions::requestSpacerStartOperation(const std::shared_ptr<TimelineItemModel> &timeline, int trackId, int position)
{
std::unordered_set<int> clips = timeline->getItemsInRange(trackId, position, -1);
if (clips.size() > 0) {
if (!clips.empty()) {
timeline->requestSetSelection(clips);
return (*clips.cbegin());
}
......@@ -356,7 +357,7 @@ bool TimelineFunctions::removeSpace(const std::shared_ptr<TimelineItemModel> &ti
std::unordered_set<int> clips = timeline->getItemsInRange(-1, zone.y() - 1, -1, true);
bool result = false;
if (clips.size() > 0) {
if (!clips.empty()) {
int clipId = *clips.begin();
if (clips.size() > 1) {
int res = timeline->requestClipsGroup(clips, undo, redo);
......@@ -384,7 +385,7 @@ bool TimelineFunctions::insertSpace(const std::shared_ptr<TimelineItemModel> &ti
std::unordered_set<int> clips = timeline->getItemsInRange(-1, zone.x(), -1, true);
bool result = true;
if (clips.size() > 0) {
if (!clips.empty()) {
int clipId = *clips.begin();
if (clips.size() > 1) {
int res = timeline->requestClipsGroup(clips, undo, redo);
......@@ -433,8 +434,8 @@ bool TimelineFunctions::requestItemCopy(const std::shared_ptr<TimelineItemModel>
} else {
const QString &transitionId = timeline->m_allCompositions[id]->getAssetId();
std::unique_ptr<Mlt::Properties> transProps(timeline->m_allCompositions[id]->properties());
res = res & timeline->requestCompositionInsertion(transitionId, target_track, -1, target_position,
timeline->m_allCompositions[id]->getPlaytime(), std::move(transProps), newId, undo, redo);
res = res && timeline->requestCompositionInsertion(transitionId, target_track, -1, target_position,
timeline->m_allCompositions[id]->getPlaytime(), std::move(transProps), newId, undo, redo);
}
} else {
res = false;
......@@ -628,7 +629,7 @@ void TimelineFunctions::setCompositionATrack(const std::shared_ptr<TimelineItemM
std::function<bool(void)> redo = []() { return true; };
std::shared_ptr<CompositionModel> compo = timeline->getCompositionPtr(cid);
int previousATrack = compo->getATrack();
int previousAutoTrack = compo->getForcedTrack() == -1;
int previousAutoTrack = static_cast<int>(compo->getForcedTrack() == -1);
bool autoTrack = aTrack < 0;
if (autoTrack) {
// Automatic track compositing, find lower video track
......@@ -651,7 +652,7 @@ void TimelineFunctions::setCompositionATrack(const std::shared_ptr<TimelineItemM
Fun local_undo = [timeline, cid, previousATrack, previousAutoTrack, start, end]() {
QScopedPointer<Mlt::Field> field(timeline->m_tractor->field());
field->lock();
timeline->getCompositionPtr(cid)->setForceTrack(!previousAutoTrack);
timeline->getCompositionPtr(cid)->setForceTrack(previousAutoTrack == 0);
timeline->getCompositionPtr(cid)->setATrack(previousATrack, previousATrack <= 0 ? -1 : timeline->getTrackIndexFromPosition(previousATrack - 1));
field->unlock();
QModelIndex modelIndex = timeline->makeCompositionIndexFromID(cid);
......@@ -986,7 +987,8 @@ int TimelineFunctions::getOffsetTrackId(const std::shared_ptr<TimelineItemModel>
if (masterTrackMltIndex < 0) {
masterTrackMltIndex = 0;
break;
} else if (masterTrackMltIndex > (int)timeline->m_allTracks.size()) {
}
if (masterTrackMltIndex > (int)timeline->m_allTracks.size()) {
masterTrackMltIndex = (int)timeline->m_allTracks.size();
break;
}
......@@ -1012,7 +1014,7 @@ QPair<QList<int>, QList<int>> TimelineFunctions::getAVTracksIds(const std::share
return {audioTracks, videoTracks};
}
QString TimelineFunctions::copyClips(const std::shared_ptr<TimelineItemModel> &timeline, const std::unordered_set<int> itemIds)
QString TimelineFunctions::copyClips(const std::shared_ptr<TimelineItemModel> &timeline, const std::unordered_set<int> &itemIds)
{
int clipId = *(itemIds.begin());
timeline->requestClearSelection();
......@@ -1262,7 +1264,7 @@ bool TimelineFunctions::pasteClips(const std::shared_ptr<TimelineItemModel> &tim
timeline->m_allClips[newId]->setInOut(in, out);
int targetId = prod.attribute(QStringLiteral("id")).toInt();
correspondingIds[targetId] = newId;
res = res & timeline->getTrackById(curTrackId)->requestClipInsertion(newId, position + pos, true, true, undo, redo);
res = res && timeline->getTrackById(curTrackId)->requestClipInsertion(newId, position + pos, true, true, undo, redo);
// paste effects
if (res) {
std::shared_ptr<EffectStackModel> destStack = timeline->getClipEffectStackModel(newId);
......
......@@ -55,7 +55,7 @@ struct TimelineFunctions
static bool cloneClip(const std::shared_ptr<TimelineItemModel> &timeline, int clipId, int &newId, PlaylistState::ClipState state, Fun &undo, Fun &redo);
/* @brief Creates a string representation of the given clips, that can then be pasted using pasteClips(). Return an empty string on failure */
static QString copyClips(const std::shared_ptr<TimelineItemModel> &timeline, const std::unordered_set<int> itemIds);
static QString copyClips(const std::shared_ptr<TimelineItemModel> &timeline, const std::unordered_set<int> &itemIds);
/* @brief Paste the clips as described by the string. Returns true on success*/
static bool pasteClips(const std::shared_ptr<TimelineItemModel> &timeline, const QString &pasteString, int trackId, int position);
......
......@@ -100,8 +100,8 @@ public:
const QString groupsData();
bool loadGroups(const QString &groupsData);
void _beginRemoveRows(const QModelIndex &, int, int) override;
void _beginInsertRows(const QModelIndex &, int, int) override;
void _beginRemoveRows(const QModelIndex & /*unused*/, int /*unused*/, int /*unused*/) override;
void _beginInsertRows(const QModelIndex & /*unused*/, int /*unused*/, int /*unused*/) override;
void _endRemoveRows() override;
void _endInsertRows() override;
void _resetView() override;
......
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