Commit 9b945e75 authored by Vincent Pinon's avatar Vincent Pinon
Browse files

clang-tidy -fix: modernize-make-unique

parent 4279e53a
......@@ -54,9 +54,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "ui_qtextclip_ui.h"
#include "undohelper.hpp"
#include "xml/xml.hpp"
#include <utils/thumbnailcache.hpp>
#include <profiles/profilemodel.hpp>
#include <dialogs/textbasededit.h>
#include <memory>
#include <profiles/profilemodel.hpp>
#include <utils/thumbnailcache.hpp>
#include <KColorScheme>
#include <KRatingPainter>
......@@ -2142,7 +2143,7 @@ void Bin::slotInitView(QAction *action)
QPixmap pix(zoom);
pix.fill(Qt::lightGray);
m_blankThumb.addPixmap(pix);
m_proxyModel.reset(new ProjectSortProxyModel(this));
m_proxyModel = std::make_unique<ProjectSortProxyModel>(this);
// Connect models
m_proxyModel->setSourceModel(m_itemModel.get());
connect(m_itemModel.get(), &QAbstractItemModel::dataChanged, m_proxyModel.get(), &ProjectSortProxyModel::slotDataChanged);
......
......@@ -76,6 +76,7 @@
#include "jogshuttle/jogshuttleconfig.h"
#include <QStandardPaths>
#include <linux/input.h>
#include <memory>
#endif
KdenliveSettingsDialog::KdenliveSettingsDialog(QMap<QString, QString> mappable_actions, bool gpuAllowed, QWidget *parent)
......@@ -2029,9 +2030,9 @@ void KdenliveSettingsDialog::processArchive(const QString archiveFile)
QMimeType type = db.mimeTypeForFile(archiveFile);
std::unique_ptr<KArchive> archive;
if (type.inherits(QStringLiteral("application/zip"))) {
archive.reset(new KZip(archiveFile));
archive = std::make_unique<KZip>(archiveFile);
} else {
archive.reset(new KTar(archiveFile));
archive = std::make_unique<KTar>(archiveFile);
}
QString modelDirectory = KdenliveSettings::vosk_folder_path();
QDir dir;
......
......@@ -30,11 +30,12 @@
#include "mlt++/MltTractor.h"
#include "mlt++/MltConsumer.h"
#include <QFontDatabase>
#include <QDir>
#include <QProcess>
#include <KLocalizedString>
#include <KMessageWidget>
#include <QDir>
#include <QFontDatabase>
#include <QProcess>
#include <memory>
SpeechDialog::SpeechDialog(const std::shared_ptr<TimelineItemModel> &timeline, QPoint zone, bool activeTrackOnly, bool selectionOnly, QWidget *parent)
: QDialog(parent)
......@@ -117,8 +118,8 @@ void SpeechDialog::slotProcessSpeech(QPoint zone)
QString speech;
QString audio;
QTemporaryFile tmpPlaylist(QDir::temp().absoluteFilePath(QStringLiteral("XXXXXX.mlt")));
m_tmpSrt.reset(new QTemporaryFile(QDir::temp().absoluteFilePath(QStringLiteral("XXXXXX.srt"))));
m_tmpAudio.reset(new QTemporaryFile(QDir::temp().absoluteFilePath(QStringLiteral("XXXXXX.wav"))));
m_tmpSrt = std::make_unique<QTemporaryFile>(QDir::temp().absoluteFilePath(QStringLiteral("XXXXXX.srt")));
m_tmpAudio = std::make_unique<QTemporaryFile>(QDir::temp().absoluteFilePath(QStringLiteral("XXXXXX.wav")));
if (tmpPlaylist.open()) {
sceneList = tmpPlaylist.fileName();
}
......@@ -177,7 +178,7 @@ void SpeechDialog::slotProcessSpeech(QPoint zone)
modelDirectory = QStandardPaths::locate(QStandardPaths::AppDataLocation, QStringLiteral("speechmodels"), QStandardPaths::LocateDirectory);
}
qDebug()<<"==== ANALYSIS SPEECH: "<<modelDirectory<<" - "<<language<<" - "<<audio<<" - "<<speech;
m_speechJob.reset(new QProcess(this));
m_speechJob = std::make_unique<QProcess>(this);
connect(m_speechJob.get(), &QProcess::readyReadStandardOutput, this, &SpeechDialog::slotProcessProgress);
connect(m_speechJob.get(), static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), [this, speech, zone](int, QProcess::ExitStatus status) {
slotProcessSpeechStatus(status, speech, zone);
......
......@@ -20,17 +20,18 @@
***************************************************************************/
#include "textbasededit.h"
#include "monitor/monitor.h"
#include "bin/bin.h"
#include "bin/projectclip.h"
#include "bin/projectsubclip.h"
#include "bin/projectitemmodel.h"
#include "timeline2/view/timelinewidget.h"
#include "timeline2/view/timelinecontroller.h"
#include "bin/projectsubclip.h"
#include "core.h"
#include "mainwindow.h"
#include "kdenlivesettings.h"
#include "mainwindow.h"
#include "monitor/monitor.h"
#include "timecodedisplay.h"
#include "timeline2/view/timelinecontroller.h"
#include "timeline2/view/timelinewidget.h"
#include <memory>
#include <profiles/profilemodel.hpp>
#include "klocalizedstring.h"
......@@ -799,7 +800,7 @@ void TextBasedEdit::startRecognition()
return;
}
m_speechJob.reset(new QProcess(this));
m_speechJob = std::make_unique<QProcess>(this);
showMessage(i18n("Starting speech recognition"), KMessageWidget::Information);
qApp->processEvents();
QString modelDirectory = KdenliveSettings::vosk_folder_path();
......@@ -862,7 +863,7 @@ void TextBasedEdit::startRecognition()
showMessage(i18n("Extracting audio for %1.", clipName), KMessageWidget::Information);
qApp->processEvents();
m_tCodeJob.reset(new QProcess(this));
m_tCodeJob = std::make_unique<QProcess>(this);
m_tCodeJob->setProcessChannelMode(QProcess::MergedChannels);
connect(m_tCodeJob.get(), static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), [this, language, pyExec, speechScript, clipName, modelDirectory, endPos](int code, QProcess::ExitStatus status) {
qDebug()<<"++++++++++++++++++++++ TCODE JOB FINISHED\n";
......
......@@ -203,7 +203,7 @@ bool AudioThumbJob::computeWithFFMPEG()
<< QStringLiteral("-f") << QStringLiteral("data") << channelFiles[size_t(i)]->fileName();
}
}
m_ffmpegProcess.reset(new QProcess);
m_ffmpegProcess = std::make_unique<QProcess>();
connect(m_ffmpegProcess.get(), &QProcess::readyReadStandardOutput, this, &AudioThumbJob::updateFfmpegProgress, Qt::UniqueConnection);
connect(this, &AudioThumbJob::jobCanceled, [&]() {
if (m_ffmpegProcess) {
......
......@@ -21,16 +21,17 @@
*/
#include <KDeclarative/KDeclarative>
#include <KLocalizedContext>
#include <KMessageBox>
#include <QApplication>
#include <QFontDatabase>
#include <QOpenGLFunctions_3_2_Core>
#include <QPainter>
#include <QQmlContext>
#include <QQuickItem>
#include <QFontDatabase>
#include <kdeclarative_version.h>
#include <KLocalizedContext>
#include <klocalizedstring.h>
#include <memory>
#include "core.h"
#include "glwidget.h"
......@@ -1358,7 +1359,7 @@ const QString GLWidget::sceneList(const QString &root, const QString &fullPath,
Mlt::Service s(m_producer->get_service());
std::unique_ptr<Mlt::Filter> filter = nullptr;
if (!filterData.isEmpty()) {
filter.reset(new Mlt::Filter (pCore->getCurrentProfile()->profile(), QString("dynamictext:%1").arg(filterData).toUtf8().constData()));
filter = std::make_unique<Mlt::Filter>(pCore->getCurrentProfile()->profile(), QString("dynamictext:%1").arg(filterData).toUtf8().constData());
filter->set("fgcolour", "#ffffff");
filter->set("bgcolour", "#bb333333");
s.attach(*filter.get());
......
......@@ -30,6 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QFont>
#include <QPaintEvent>
#include <QPainter>
#include <memory>
const double log_factor = 1.0 / log10(1.0 / 127);
......@@ -50,7 +51,7 @@ MonitorAudioLevel::MonitorAudioLevel(int height, QWidget *parent)
, m_channelFillHeight(m_channelHeight)
{
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
m_filter.reset(new Mlt::Filter(pCore->getCurrentProfile()->profile(), "audiolevel"));
m_filter = std::make_unique<Mlt::Filter>(pCore->getCurrentProfile()->profile(), "audiolevel");
if (!m_filter->is_valid()) {
isValid = false;
return;
......
......@@ -31,6 +31,7 @@
#include "kdenlivesettings.h"
#include <KMessageBox>
#include <QFontDatabase>
#include <memory>
#include <mlt++/Mlt.h>
ClipStabilize::ClipStabilize(const std::vector<QString> &binIds, QString filterName, QWidget *parent)
......@@ -64,7 +65,7 @@ ClipStabilize::ClipStabilize(const std::vector<QString> &binIds, QString filterN
}
m_vbox = new QVBoxLayout(optionsbox);
if (m_filtername == QLatin1String("vidstab")) {
m_view.reset(new AssetParameterView(this));
m_view = std::make_unique<AssetParameterView>(this);
qDebug()<<"// Fetching effect: "<<m_filtername;
std::unique_ptr<Mlt::Filter> asset = EffectsRepository::get()->getEffect(m_filtername);
auto prop = std::make_unique<Mlt::Properties>(asset->get_properties());
......
......@@ -40,6 +40,7 @@
#include <QTreeWidget>
#include <QtConcurrent>
#include <memory>
#include <utility>
ArchiveWidget::ArchiveWidget(const QString &projectName, const QString xmlData, const QStringList &luma_list, QWidget *parent)
: QDialog(parent)
......@@ -961,9 +962,9 @@ void ArchiveWidget::createArchive()
QString group = dirInfo.group();
std::unique_ptr<KArchive> archive;
if (compression_type->currentIndex() == 1) {
archive.reset(new KZip(m_archiveName));
archive = std::make_unique<KZip>(m_archiveName);
} else {
archive.reset(new KTar(m_archiveName, QStringLiteral("application/x-gzip")));
archive = std::make_unique<KTar>(m_archiveName, QStringLiteral("application/x-gzip"));
}
archive->open(QIODevice::WriteOnly);
......
......@@ -31,11 +31,12 @@
#else
#define TRACE_CONSTR(...)
#endif
#include "snapmodel.hpp"
#include "jobs/jobmanager.h"
#include "snapmodel.hpp"
#include "timelinemodel.hpp"
#include <QDebug>
#include <QModelIndex>
#include <memory>
#include <mlt++/MltTransition.h>
TrackModel::TrackModel(const std::weak_ptr<TimelineModel> &parent, int id, const QString &trackName, bool audioTrack)
......@@ -1846,7 +1847,7 @@ bool TrackModel::requestClipMix(std::pair<int, int> clipIds, int mixDuration, bo
QString assetName;
std::unique_ptr<Mlt::Transition>t;
if (isAudioTrack()) {
t.reset(new Mlt::Transition(*ptr->getProfile(), "mix"));
t = std::make_unique<Mlt::Transition>(*ptr->getProfile(), "mix");
t->set_in_and_out(mixPosition, mixPosition + mixDuration);
t->set("kdenlive:mixcut", secondClipCut);
t->set("start", -1);
......@@ -1857,7 +1858,7 @@ bool TrackModel::requestClipMix(std::pair<int, int> clipIds, int mixDuration, bo
m_track->plant_transition(*t.get(), 0, 1);
assetName = QStringLiteral("mix");
} else {
t.reset(new Mlt::Transition(*ptr->getProfile(), "luma"));
t = std::make_unique<Mlt::Transition>(*ptr->getProfile(), "luma");
t->set_in_and_out(mixPosition, mixPosition + mixDuration);
t->set("kdenlive:mixcut", secondClipCut);
t->set("kdenlive_id", "luma");
......@@ -2043,7 +2044,7 @@ bool TrackModel::createMix(MixInfo info, bool isAudio)
QString assetName;
std::unique_ptr<Mlt::Transition> t;
if (isAudio) {
t.reset(new Mlt::Transition(*ptr->getProfile(), "mix"));
t = std::make_unique<Mlt::Transition>(*ptr->getProfile(), "mix");
t->set_in_and_out(in, out);
t->set("start", -1);
t->set("accepts_blanks", 1);
......@@ -2053,7 +2054,7 @@ bool TrackModel::createMix(MixInfo info, bool isAudio)
m_track->plant_transition(*t.get(), 0, 1);
assetName = QStringLiteral("mix");
} else {
t.reset(new Mlt::Transition(*ptr->getProfile(), "luma"));
t = std::make_unique<Mlt::Transition>(*ptr->getProfile(), "luma");
t->set_in_and_out(in, out);
t->set("kdenlive_id", "luma");
if (reverse) {
......@@ -2086,7 +2087,7 @@ bool TrackModel::createMix(std::pair<int, int> clipIds, std::pair<int, int> mixD
QString assetName;
std::unique_ptr<Mlt::Transition> t;
if (isAudioTrack()) {
t.reset(new Mlt::Transition(*ptr->getProfile(), "mix"));
t = std::make_unique<Mlt::Transition>(*ptr->getProfile(), "mix");
t->set_in_and_out(mixData.first, mixData.first + mixData.second);
t->set("start", -1);
t->set("accepts_blanks", 1);
......@@ -2096,7 +2097,7 @@ bool TrackModel::createMix(std::pair<int, int> clipIds, std::pair<int, int> mixD
m_track->plant_transition(*t.get(), 0, 1);
assetName = QStringLiteral("mix");
} else {
t.reset(new Mlt::Transition(*ptr->getProfile(), "luma"));
t = std::make_unique<Mlt::Transition>(*ptr->getProfile(), "luma");
t->set("kdenlive_id", "luma");
t->set_in_and_out(mixData.first, mixData.first + mixData.second);
if (reverse) {
......
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