Commit 2e040676 authored by Julius Künzel's avatar Julius Künzel
Browse files

Fix a possible build error and some clazy warnings

parent 86373198
Pipeline #73860 passed with stage
in 8 minutes and 38 seconds
......@@ -136,7 +136,7 @@ template <typename AssetType> void AbstractAssetsRepository<AssetType>::init()
// Remove really invalid assets
emptyMetaAssets << missingDependency;
emptyMetaAssets.removeDuplicates();
for (const auto &invalid : emptyMetaAssets) {
for (const auto &invalid : qAsConst(emptyMetaAssets)) {
m_assets.erase(invalid);
}
}
......
......@@ -337,7 +337,7 @@ const QString AssetPanel::getStyleSheet()
QColor hover_bg = scheme.decoration(KColorScheme::HoverColor).color();
QColor light_bg = scheme.shade(KColorScheme::LightShade);
QColor alt_bg = scheme.background(KColorScheme::NormalBackground).color();
QColor normal_bg = QApplication::palette().window().color();
//QColor normal_bg = QApplication::palette().window().color();
QString stylesheet;
......
......@@ -62,7 +62,6 @@ void RectHelper::slotUpdateFromMonitorRect(const QRect &rect) {
void RectHelper::refreshParams(int pos)
{
QVariantList points{QPointF(), QPointF(), QPointF(), QPointF()};
int x = 0, y = 0, w = 500, h = 500;
QSize frameSize = pCore->getCurrentFrameSize();
for (const auto &ix : qAsConst(m_indexes)) {
......
......@@ -49,10 +49,10 @@ public:
/** @brief Send signals to the monitor to update the qml overlay.
@param returns : true if the monitor's connection was changed to active.
*/
bool connectMonitor(bool activate);
bool connectMonitor(bool activate) override;
/** @brief Send data update to the monitor
*/
void refreshParams(int pos);
void refreshParams(int pos) override;
private slots:
void slotUpdateFromMonitorRect(const QRect &rect);
......
......@@ -30,6 +30,7 @@
#include <QJsonArray>
#include <QJsonObject>
#include <QString>
#include <QRegularExpression>
#include <effects/effectsrepository.hpp>
#define DEBUG_LOCALE false
......@@ -808,7 +809,7 @@ QJsonDocument AssetParameterModel::toJson(bool includeFixed) const
}
QString x, y, w, h;
int rectIn, rectOut;
int rectIn = 0, rectOut = 0;
for (const auto &param : m_params) {
if (!includeFixed && param.second.type != ParamType::KeyframeParam && param.second.type != ParamType::AnimatedRect) {
continue;
......
......@@ -263,7 +263,7 @@ const QString ClipCreator::createClipsFromList(const QList<QUrl> &list, bool che
bool created = false;
QMimeDatabase db;
bool removableProject = checkRemovable ? isOnRemovableDevice(pCore->currentDoc()->projectDataFolder()) : false;
for (const QUrl &file : cleanList) {
for (const QUrl &file : qAsConst(cleanList)) {
if (!QFile::exists(file.toLocalFile())) {
continue;
}
......
......@@ -597,7 +597,7 @@ bool ProjectClip::setProducer(std::shared_ptr<Mlt::Producer> producer)
});
}
if (generateProxy) {
QMetaObject::invokeMethod(pCore->currentDoc(), "slotProxyCurrentItem", Q_ARG(bool,true), Q_ARG(QList<std::shared_ptr<ProjectClip>>,clipList), Q_ARG(bool,false));
QMetaObject::invokeMethod(pCore->currentDoc(), "slotProxyCurrentItem", Q_ARG(bool,true), Q_ARG(QList<std::shared_ptr<ProjectClip> >,clipList), Q_ARG(bool,false));
}
return true;
}
......@@ -1260,7 +1260,6 @@ void ProjectClip::setProperties(const QMap<QString, QString> &properties, bool r
// If value is "-", that means user manually disabled proxy on this clip
if (value.isEmpty() || value == QLatin1String("-")) {
// reset proxy
int id;
if (pCore->taskManager.hasPendingJob({ObjectType::BinClip, m_binId.toInt()}, AbstractTask::PROXYJOB)) {
// The proxy clip is being created, abort
pCore->taskManager.discardJobs({ObjectType::BinClip, m_binId.toInt()}, AbstractTask::PROXYJOB);
......@@ -1618,9 +1617,9 @@ const QString ProjectClip::geometryWithOffset(const QString &data, int offset)
if (offset == 0) {
return data;
}
auto &profile = pCore->getCurrentProfile();
// TODO MLT7: port to Mlt::Animation
/*Mlt::Geometry geometry(data.toUtf8().data(), duration().frames(profile->fps()), profile->width(), profile->height());
/*auto &profile = pCore->getCurrentProfile();
Mlt::Geometry geometry(data.toUtf8().data(), duration().frames(profile->fps()), profile->width(), profile->height());
Mlt::Geometry newgeometry(nullptr, duration().frames(profile->fps()), profile->width(), profile->height());
Mlt::GeometryItem item;
int pos = 0;
......
......@@ -67,6 +67,7 @@
#include <QThread>
#include <QTimer>
#include <QtConcurrent>
#include <QRegularExpression>
#include <cstdio>
#include <cstdlib>
#include <fcntl.h>
......@@ -1862,7 +1863,7 @@ void KdenliveSettingsDialog::initSpeechPage()
}
});
checkVoskDependencies();
connect(m_configSpeech.custom_vosk_folder, &QCheckBox::stateChanged, [this](int state) {
connect(m_configSpeech.custom_vosk_folder, &QCheckBox::stateChanged, this, [this](int state) {
m_configSpeech.vosk_folder->setEnabled(state != Qt::Unchecked);
if (state == Qt::Unchecked) {
// Clear custom folder
......@@ -1871,12 +1872,12 @@ void KdenliveSettingsDialog::initSpeechPage()
slotParseVoskDictionaries();
}
});
connect(m_configSpeech.vosk_folder, &KUrlRequester::urlSelected, [this](QUrl url) {
connect(m_configSpeech.vosk_folder, &KUrlRequester::urlSelected, this, [this](QUrl url) {
KdenliveSettings::setVosk_folder_path(url.toLocalFile());
slotParseVoskDictionaries();
});
m_configSpeech.models_url->setText(i18n("Download speech models from: <a href=\"https://alphacephei.com/vosk/models\">https://alphacephei.com/vosk/models</a>"));
connect(m_configSpeech.models_url, &QLabel::linkActivated, [&](const QString &contents) {
connect(m_configSpeech.models_url, &QLabel::linkActivated, this, [&](const QString &contents) {
qDebug()<<"=== LINK CLICKED: "<<contents;
#if KIO_VERSION > QT_VERSION_CHECK(5, 70, 0)
auto *job = new KIO::OpenUrlJob(QUrl(contents));
......@@ -2013,7 +2014,6 @@ void KdenliveSettingsDialog::getDictionary(const QUrl sourceUrl)
if (url.isEmpty()) {
return;
}
QString tmpFile;
if (!url.isLocalFile()) {
KIO::FileCopyJob *copyjob = KIO::file_copy(url, QUrl::fromLocalFile(QDir::temp().absoluteFilePath(url.fileName())));
doShowSpeechMessage(i18n("Downloading model..."), KMessageWidget::Information);
......
......@@ -59,7 +59,7 @@ ProxyTest::ProxyTest(QWidget *parent)
paramBox->setVisible(false);
}
});
connect(buttonBox->button(QDialogButtonBox::Apply), &QPushButton::clicked, [this]() {
connect(buttonBox->button(QDialogButtonBox::Apply), &QPushButton::clicked, this, [this]() {
infoWidget->setText(i18n("Starting process"));
infoWidget->animatedShow();
resultList->setCursor(Qt::BusyCursor);
......
......@@ -51,7 +51,7 @@ SpeechDialog::SpeechDialog(std::shared_ptr<TimelineItemModel> timeline, QPoint z
connect(m_voskConfig, &QAction::triggered, []() {
pCore->window()->slotPreferences(8);
});
m_modelsConnection = connect(pCore.get(), &Core::voskModelUpdate, [&](QStringList models) {
m_modelsConnection = connect(pCore.get(), &Core::voskModelUpdate, this, [&](QStringList models) {
language_box->clear();
language_box->addItems(models);
if (models.isEmpty()) {
......@@ -68,16 +68,16 @@ SpeechDialog::SpeechDialog(std::shared_ptr<TimelineItemModel> timeline, QPoint z
}
}
});
connect(language_box, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), [this]() {
connect(language_box, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, [this]() {
KdenliveSettings::setVosk_srt_model(language_box->currentText());
});
connect(buttonBox->button(QDialogButtonBox::Apply), &QPushButton::clicked, [this, zone]() {
connect(buttonBox->button(QDialogButtonBox::Apply), &QPushButton::clicked, this, [this, zone]() {
slotProcessSpeech(zone);
});
parseVoskDictionaries();
frame_progress->setVisible(false);
button_abort->setIcon(QIcon::fromTheme(QStringLiteral("process-stop")));
connect(button_abort, &QToolButton::clicked, [this]() {
connect(button_abort, &QToolButton::clicked, this, [this]() {
if (m_speechJob && m_speechJob->state() == QProcess::Running) {
m_speechJob->kill();
}
......@@ -181,7 +181,7 @@ void SpeechDialog::slotProcessSpeech(QPoint zone)
qDebug()<<"==== ANALYSIS SPEECH: "<<modelDirectory<<" - "<<language<<" - "<<audio<<" - "<<speech;
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) {
connect(m_speechJob.get(), static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished), this, [this, speech, zone](int, QProcess::ExitStatus status) {
slotProcessSpeechStatus(status, speech, zone);
});
m_speechJob->start(pyExec, {speechScript, modelDirectory, language, audio, speech});
......
......@@ -73,12 +73,12 @@ SubtitleEdit::SubtitleEdit(QWidget *parent)
auto *keyFilter = new ShiftEnterFilter(this);
subText->installEventFilter(keyFilter);
connect(keyFilter, &ShiftEnterFilter::triggerUpdate, this, &SubtitleEdit::updateSubtitle);
connect(subText, &KTextEdit::textChanged, [this]() {
connect(subText, &KTextEdit::textChanged, this, [this]() {
if (m_activeSub > -1) {
buttonApply->setEnabled(true);
}
});
connect(subText, &KTextEdit::cursorPositionChanged, [this]() {
connect(subText, &KTextEdit::cursorPositionChanged, this, [this]() {
if (m_activeSub > -1) {
buttonCut->setEnabled(true);
}
......@@ -99,7 +99,7 @@ SubtitleEdit::SubtitleEdit(QWidget *parent)
duration_box->addWidget(m_duration);
spacer = new QSpacerItem(1, 1, QSizePolicy::MinimumExpanding, QSizePolicy::Maximum);
duration_box->addSpacerItem(spacer);
connect(m_position, &TimecodeDisplay::timeCodeEditingFinished, [this] (int value) {
connect(m_position, &TimecodeDisplay::timeCodeEditingFinished, this, [this] (int value) {
updateSubtitle();
if (buttonLock->isChecked()) {
// Perform a move instead of a resize
......@@ -109,7 +109,7 @@ SubtitleEdit::SubtitleEdit(QWidget *parent)
m_model->requestResize(m_activeSub, duration.frames(pCore->getCurrentFps()), false);
}
});
connect(m_endPosition, &TimecodeDisplay::timeCodeEditingFinished, [this] (int value) {
connect(m_endPosition, &TimecodeDisplay::timeCodeEditingFinished, this, [this] (int value) {
updateSubtitle();
if (buttonLock->isChecked()) {
// Perform a move instead of a resize
......@@ -119,7 +119,7 @@ SubtitleEdit::SubtitleEdit(QWidget *parent)
m_model->requestResize(m_activeSub, duration.frames(pCore->getCurrentFps()), true);
}
});
connect(m_duration, &TimecodeDisplay::timeCodeEditingFinished, [this] (int value) {
connect(m_duration, &TimecodeDisplay::timeCodeEditingFinished, this, [this] (int value) {
updateSubtitle();
m_model->requestResize(m_activeSub, value, true);
});
......@@ -163,7 +163,7 @@ void SubtitleEdit::setModel(std::shared_ptr<SubtitleModel> model)
QSignalBlocker bk(subText);
subText->clear();
} else {
connect(m_model.get(), &SubtitleModel::dataChanged, [this](const QModelIndex &start, const QModelIndex &, const QVector <int>&roles) {
connect(m_model.get(), &SubtitleModel::dataChanged, this, [this](const QModelIndex &start, const QModelIndex &, const QVector <int>&roles) {
if (m_activeSub > -1 && start.row() == m_model->getRowForId(m_activeSub)) {
if (roles.contains(SubtitleModel::SubtitleRole) || roles.contains(SubtitleModel::StartFrameRole) || roles.contains(SubtitleModel::EndFrameRole)) {
setActiveSubtitle(m_activeSub);
......
......@@ -1025,13 +1025,11 @@ QString DocumentChecker::searchPathRecursively(const QDir &dir, const QString &f
QString DocumentChecker::searchDirRecursively(const QDir &dir, const QString &matchHash, const QString &fullName)
{
QString foundFileName;
qApp->processEvents();
if (m_abortSearch) {
return QString();
}
emit showScanning(i18n("Scanning %1", dir.absolutePath()));
QDir searchDir(dir);
QStringList filesAndDirs;
QString fileName = QFileInfo(fullName).fileName();
// Check main dir
......
......@@ -369,7 +369,7 @@ void MainWindow::init(const QString &mltPath)
// Online resources widget
auto *onlineResources = new ResourceWidget(this);
m_onlineResourcesDock = addDock(i18n("Online Resources"), QStringLiteral("onlineresources"), onlineResources);
connect(onlineResources, &ResourceWidget::previewClip, [&](const QString &path, const QString &title) {
connect(onlineResources, &ResourceWidget::previewClip, this, [&](const QString &path, const QString &title) {
m_clipMonitor->slotPreviewResource(path, title);
m_clipMonitorDock->show();
m_clipMonitorDock->raise();
......@@ -828,7 +828,7 @@ void MainWindow::init(const QString &mltPath)
#endif
getMainTimeline()->setTimelineMenu(timelineClipMenu, compositionMenu, timelineMenu, guideMenu, timelineRulerMenu, actionCollection()->action(QStringLiteral("edit_guide")), timelineHeadersMenu, thumbsMenu , timelineSubtitleMenu);
scmanager->slotCheckActiveScopes();
connect(qApp, &QGuiApplication::applicationStateChanged, [&](Qt::ApplicationState state) {
connect(qApp, &QGuiApplication::applicationStateChanged, this, [&](Qt::ApplicationState state) {
if (state == Qt::ApplicationActive) {
getMainTimeline()->regainFocus();
}
......@@ -1186,7 +1186,7 @@ void MainWindow::setupActions()
m_buttonSubtitleEditTool->setCheckable(true);
m_buttonSubtitleEditTool->setChecked(false);
addAction(QStringLiteral("subtitle_tool"), m_buttonSubtitleEditTool);
connect(m_buttonSubtitleEditTool, &QAction::triggered, [this]() {
connect(m_buttonSubtitleEditTool, &QAction::triggered, this, [this]() {
slotEditSubtitle();
});
......@@ -1217,7 +1217,7 @@ void MainWindow::setupActions()
QAction *sameTrack = new QAction(QIcon::fromTheme(QStringLiteral("composite-track-preview")), i18n("Mix Clips"), this);
addAction(QStringLiteral("mix_clip"), sameTrack, Qt::Key_U);
connect(sameTrack, &QAction::triggered, [this]() {
connect(sameTrack, &QAction::triggered, this, [this]() {
getCurrentTimeline()->controller()->mixClip();
});
......@@ -1691,7 +1691,7 @@ void MainWindow::setupActions()
delEffects->setEnabled(false);
// "C" as data means this action should only be available for clips - not for compositions
delEffects->setData('C');
connect(delEffects, &QAction::triggered, [this]() {
connect(delEffects, &QAction::triggered, this, [this]() {
getMainTimeline()->controller()->deleteEffects();
});
......@@ -3557,14 +3557,14 @@ void MainWindow::buildDynamicActions()
if ((filter != nullptr) && filter->is_valid()) {
QAction *action = new QAction(i18n("Stabilize"), m_extraFactory->actionCollection());
ts->addAction(action->text(), action);
connect(action, &QAction::triggered, [this]() {
connect(action, &QAction::triggered, this, [this]() {
StabilizeTask::start(this);
});
}
QAction *action = new QAction(i18n("Automatic scene split"), m_extraFactory->actionCollection());
ts->addAction(action->text(), action);
connect(action, &QAction::triggered, [&]() {
connect(action, &QAction::triggered, this, [&]() {
SceneSplitTask::start(this);
});
......
......@@ -122,14 +122,14 @@ ProviderModel::ProviderModel(const QString &path)
});
connect(&m_oauth2, &QOAuth2AuthorizationCodeFlow::statusChanged, [=](QAbstractOAuth::Status status) {
connect(&m_oauth2, &QOAuth2AuthorizationCodeFlow::statusChanged, this, [=](QAbstractOAuth::Status status) {
if (status == QAbstractOAuth::Status::Granted ) {
emit authenticated(m_oauth2.token());
} else if (status == QAbstractOAuth::Status::NotAuthenticated) {
KMessageBox::error(nullptr, "DEBUG: NotAuthenticated");
}
});
connect(&m_oauth2, &QOAuth2AuthorizationCodeFlow::error, [=](const QString &error, const QString &errorDescription) {
connect(&m_oauth2, &QOAuth2AuthorizationCodeFlow::error, this, [=](const QString &error, const QString &errorDescription) {
qCWarning(KDENLIVE_LOG) << "Error in authorization flow. " << error << " " << errorDescription;
emit authenticated(QString());
});
......@@ -405,7 +405,7 @@ void ProviderModel::slotStartSearch(const QString &searchText, const int page)
}
QNetworkReply *reply = manager->get(request);
connect(reply, &QNetworkReply::finished, [=]() {
connect(reply, &QNetworkReply::finished, this, [=]() {
if(reply->error() == QNetworkReply::NoError) {
QByteArray response = reply->readAll();
std::pair<QList<ResourceItemInfo>, const int> result = parseSearchResponse(response);
......@@ -540,7 +540,7 @@ void ProviderModel::slotFetchFiles(const QString &id) {
}
QNetworkReply *reply = manager->get(request);
connect(reply, &QNetworkReply::finished, [=]() {
connect(reply, &QNetworkReply::finished, this, [=]() {
if(reply->error() == QNetworkReply::NoError) {
QByteArray response = reply->readAll();
std::pair<QStringList, QStringList> result = parseFilesResponse(response, id);
......
......@@ -272,9 +272,6 @@ void ResourceWidget::slotSearchFinished(QList<ResourceItemInfo> &list, const int
QListWidgetItem *listItem = new QListWidgetItem(item.name.isEmpty() ? (item.author.isEmpty() ? i18n("Unnamed") : i18nc("Created by author name", "Created by %1", item.author)) : item.name);
if(!item.imageUrl.isEmpty()) {
QUrl img(item.imageUrl);
if (img.isEmpty()) {
return;
}
m_tmpThumbFile->close();
if (m_tmpThumbFile->open()) {
KIO::FileCopyJob *copyjob = KIO::file_copy(img, QUrl::fromLocalFile(m_tmpThumbFile->fileName()), -1, KIO::HideProgressInfo | KIO::Overwrite);
......
......@@ -996,7 +996,6 @@ QString ArchiveWidget::processMltFile(QDomDocument doc, const QString &destPrefi
// process mlt transitions (for luma files)
prods = mlt.elementsByTagName(QStringLiteral("transition"));
QString attribute;
for (int i = 0; i < prods.count(); ++i) {
QDomElement e = prods.item(i).toElement();
if (e.isNull()) {
......
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