Commit 7df11708 authored by Laurent Montel's avatar Laurent Montel
Browse files

KMessageBox::sorry is deprecated in kf5.97

parent b80f7a0d
Pipeline #210547 passed with stage
in 6 minutes and 47 seconds
......@@ -85,14 +85,14 @@ QUrl SamplePlugin::generatedClip(const QString &renderer, const QString &generat
if (generatorProcess.exitStatus() == QProcess::CrashExit) {
// qDebug() << "/// Generator failed: ";
QString error = QString::fromLocal8Bit(generatorProcess.readAllStandardError());
KMessageBox::sorry(QApplication::activeWindow(), i18n("Failed to generate clip:\n%1", error), i18n("Generator Failed"));
KMessageBox::error(QApplication::activeWindow(), i18n("Failed to generate clip:\n%1", error), i18n("Generator Failed"));
} else {
result = view.path->url();
}
} else {
// qDebug() << "/// Generator failed: ";
QString error = QString::fromLocal8Bit(generatorProcess.readAllStandardError());
KMessageBox::sorry(QApplication::activeWindow(), i18n("Failed to generate clip:\n%1", error), i18n("Generator Failed"));
KMessageBox::error(QApplication::activeWindow(), i18n("Failed to generate clip:\n%1", error), i18n("Generator Failed"));
}
}
delete d;
......
......@@ -1828,7 +1828,7 @@ void Bin::slotReloadClip()
KIO::FileCopyJob *copyjob = KIO::file_copy(QUrl::fromLocalFile(path), QUrl::fromLocalFile(backupFile));
if (copyjob->exec()) {
if (!f.open(QIODevice::WriteOnly | QIODevice::Text)) {
KMessageBox::sorry(this, i18n("Unable to write to file %1", path));
KMessageBox::error(this, i18n("Unable to write to file %1", path));
} else {
QTextStream out(&f);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
......@@ -1896,7 +1896,7 @@ void Bin::slotReplaceClip()
}
}
} else {
KMessageBox::sorry(this, i18n("The selected file %1 is invalid.", fileName));
KMessageBox::error(this, i18n("The selected file %1 is invalid.", fileName));
continue;
}
}
......@@ -2172,7 +2172,7 @@ void Bin::createClip(const QDomElement &xml)
KIO::FileCopyJob *copyjob = KIO::file_copy(QUrl::fromLocalFile(path), QUrl::fromLocalFile(backupFile));
if (copyjob->exec()) {
if (!f.open(QIODevice::WriteOnly | QIODevice::Text)) {
KMessageBox::sorry(this, i18n("Unable to write to file %1", path));
KMessageBox::error(this, i18n("Unable to write to file %1", path));
} else {
QTextStream out(&f);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
......@@ -3351,7 +3351,7 @@ void Bin::doDisplayMessage(const QString &text, KMessageWidget::MessageType type
QAction *ac = new QAction(i18n("Show log"), this);
m_infoMessage->addAction(ac);
connect(ac, &QAction::triggered, this, [this, logInfo](bool) {
KMessageBox::sorry(this, logInfo, i18n("Detailed log"));
KMessageBox::error(this, logInfo, i18n("Detailed log"));
slotMessageActionTriggered();
});
m_infoMessage->setCloseButtonVisible(false);
......@@ -4059,7 +4059,7 @@ void Bin::slotOpenClipExtern()
if (!KdenliveSettings::defaultimageapp().isEmpty()) {
openExternalApp(KdenliveSettings::defaultimageapp(), clip->url());
} else {
KMessageBox::sorry(QApplication::activeWindow(), i18n("Please set a default application to open image files"));
KMessageBox::error(QApplication::activeWindow(), i18n("Please set a default application to open image files"));
}
} break;
case ClipType::Audio: {
......@@ -4076,7 +4076,7 @@ void Bin::slotOpenClipExtern()
if (!KdenliveSettings::defaultaudioapp().isEmpty()) {
openExternalApp(KdenliveSettings::defaultaudioapp(), clip->url());
} else {
KMessageBox::sorry(QApplication::activeWindow(), i18n("Please set a default application to open audio files"));
KMessageBox::error(QApplication::activeWindow(), i18n("Please set a default application to open audio files"));
}
} break;
case ClipType::Animation: {
......@@ -4093,7 +4093,7 @@ void Bin::slotOpenClipExtern()
if (!KdenliveSettings::glaxnimatePath().isEmpty()) {
openExternalApp(KdenliveSettings::glaxnimatePath(), clip->url());
} else {
KMessageBox::sorry(QApplication::activeWindow(), i18n("Please set a path for the Glaxnimate application"));
KMessageBox::error(QApplication::activeWindow(), i18n("Please set a path for the Glaxnimate application"));
}
} break;
default:
......
......@@ -77,7 +77,7 @@ QDomDocument ClipCreator::getXmlFromUrl(const QString &path)
QUrl fileUrl = QUrl::fromLocalFile(path);
if (fileUrl.matches(pCore->currentDoc()->url(), QUrl::RemoveScheme | QUrl::NormalizePathSegments)) {
// Cannot embed a project in itself
KMessageBox::sorry(QApplication::activeWindow(), i18n("You cannot add a project inside itself."), i18n("Cannot create clip"));
KMessageBox::error(QApplication::activeWindow(), i18n("You cannot add a project inside itself."), i18n("Cannot create clip"));
return xml;
}
QMimeDatabase db;
......
......@@ -190,7 +190,7 @@ void Core::initGUI(bool inSandbox, const QString &MltPath, const QUrl &Url, cons
profileChanged();
if (!ProfileRepository::get()->profileExists(m_profile)) {
KMessageBox::sorry(m_mainWindow, i18n("The default profile of Kdenlive is not set or invalid, press OK to set it to a correct value."));
KMessageBox::error(m_mainWindow, i18n("The default profile of Kdenlive is not set or invalid, press OK to set it to a correct value."));
// TODO this simple widget should be improved and probably use profileWidget
// we get the list of profiles
......
......@@ -159,7 +159,7 @@ void ClipCreationDialog::createColorClip(KdenliveDoc *doc, const QString &parent
void ClipCreationDialog::createAnimationClip(KdenliveDoc *doc, const QString &parentId)
{
if (KdenliveSettings::glaxnimatePath().isEmpty()) {
KMessageBox::sorry(QApplication::activeWindow(), i18n("Please install Glaxnimate to edit Lottie animations."));
KMessageBox::error(QApplication::activeWindow(), i18n("Please install Glaxnimate to edit Lottie animations."));
return;
}
QDir dir(doc->projectDataFolder());
......@@ -422,7 +422,7 @@ KGuiItem(i18n("Continue")), KStandardGuiItem::cancel(), QString("copyFilesToProj
KIO::MkdirJob *mkdirJob = KIO::mkdir(QUrl::fromLocalFile(sourcesFolder.absolutePath()));
KJobWidgets::setWindow(mkdirJob, QApplication::activeWindow());
if (!mkdirJob->exec()) {
KMessageBox::sorry(QApplication::activeWindow(), i18n("Cannot create directory %1", sourcesFolder.absolutePath()));
KMessageBox::error(QApplication::activeWindow(), i18n("Cannot create directory %1", sourcesFolder.absolutePath()));
continue;
}
//KIO::filesize_t m_requestedSize;
......
......@@ -1325,7 +1325,7 @@ void KdenliveSettingsDialog::slotAddTranscode()
QInputDialog::getText(this, i18nc("@title:window", "Enter Preset Name"), i18n("Enter the name of this preset:"), QLineEdit::Normal, QString(), &ok);
if (!ok) return;
if (!m_configTranscode.profiles_list->findItems(presetName, Qt::MatchExactly).isEmpty()) {
KMessageBox::sorry(this, i18n("A profile with that name already exists"));
KMessageBox::error(this, i18n("A profile with that name already exists"));
return;
}
QListWidgetItem *item = new QListWidgetItem(presetName);
......
......@@ -239,7 +239,7 @@ bool ProfilesDialog::slotSaveProfile()
// this profile name already exists
const QString path = m_view.profiles_list->itemData(ix).toString();
if (!path.contains(QLatin1Char('/'))) {
KMessageBox::sorry(
KMessageBox::error(
this, i18n("A profile with same name already exists in MLT's default profiles, please choose another description for your custom profile."));
return false;
}
......
......@@ -290,7 +290,7 @@ RenderWidget::RenderWidget(bool enableProxy, QWidget *parent)
if (!QFile::exists(m_renderer)) {
m_renderer = QStandardPaths::findExecutable(QStringLiteral("kdenlive_render"));
if (m_renderer.isEmpty()) {
KMessageBox::sorry(this,
KMessageBox::error(this,
i18n("Could not find the kdenlive_render application, something is wrong with your installation. Rendering will not work"));
}
}
......@@ -624,7 +624,7 @@ void RenderWidget::slotPrepareExport(bool delayedRendering, const QString &scrip
// mantisbt 1051
QDir dir(m_view.out_file->url().adjusted(QUrl::RemoveFilename).toLocalFile());
if (!dir.exists() && !dir.mkpath(QStringLiteral("."))) {
KMessageBox::sorry(this, i18n("The directory %1, could not be created.\nPlease make sure you have the required permissions.",
KMessageBox::error(this, i18n("The directory %1, could not be created.\nPlease make sure you have the required permissions.",
m_view.out_file->url().adjusted(QUrl::RemoveFilename).toLocalFile()));
return;
}
......@@ -668,7 +668,7 @@ void RenderWidget::prepareRendering(bool delayedRendering)
QTemporaryFile src(QDir::temp().absoluteFilePath(QString("XXXXXX.srt")));
if (!src.open()) {
// Something went wrong
KMessageBox::sorry(this, i18n("Could not create temporary subtitle file"));
KMessageBox::error(this, i18n("Could not create temporary subtitle file"));
return;
}
subtitleFile = src.fileName();
......@@ -743,7 +743,7 @@ void RenderWidget::prepareRendering(bool delayedRendering)
QTemporaryFile src(QDir::temp().absoluteFilePath(QString("XXXXXX.srt")));
if (!src.open()) {
// Something went wrong
KMessageBox::sorry(this, i18n("Could not create temporary subtitle file"));
KMessageBox::error(this, i18n("Could not create temporary subtitle file"));
return;
}
subtitleFile = src.fileName();
......
......@@ -622,7 +622,7 @@ TextBasedEdit::TextBasedEdit(QWidget *parent)
info_message->hide();
m_logAction = new QAction(i18n("Show log"), this);
connect(m_logAction, &QAction::triggered, this, [this]() { KMessageBox::sorry(this, m_errorString, i18n("Detailed log")); });
connect(m_logAction, &QAction::triggered, this, [this]() { KMessageBox::error(this, m_errorString, i18n("Detailed log")); });
speech_zone->setChecked(KdenliveSettings::speech_zone());
connect(speech_zone, &QCheckBox::stateChanged, [](int state) { KdenliveSettings::setSpeech_zone(state == Qt::Checked); });
......
......@@ -75,7 +75,7 @@ QPair<bool, QString> DocumentValidator::validate(const double currentVersion)
if (localeMatch.second == LocaleHandling::MatchType::NoMatch) {
// Requested locale not available, ask for install
KMessageBox::sorry(QApplication::activeWindow(),
KMessageBox::error(QApplication::activeWindow(),
i18n("The document was created in \"%1\" locale, which is not installed on your system. Please install that language pack. "
"Until then, Kdenlive might not be able to correctly open the document.",
mltLocale));
......@@ -115,7 +115,7 @@ QPair<bool, QString> DocumentValidator::validate(const double currentVersion)
}
if (qFuzzyIsNull(version)) {
// version missing, try with latest
KMessageBox::sorry(QApplication::activeWindow(), i18n("Version of the project file cannot be read.\nAttempting to open nonetheless."),
KMessageBox::error(QApplication::activeWindow(), i18n("Version of the project file cannot be read.\nAttempting to open nonetheless."),
i18n("Incorrect project file"));
version = currentVersion;
}
......@@ -148,7 +148,7 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
// The document is too new
if (version > currentVersion) {
// qCDebug(KDENLIVE_LOG) << "Unable to open document with version " << version;
KMessageBox::sorry(
KMessageBox::error(
QApplication::activeWindow(),
i18n("This project type is unsupported (version %1) and cannot be loaded.\nPlease consider upgrading your Kdenlive version.", version),
i18n("Unable to open project"));
......@@ -159,7 +159,7 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
if (qFuzzyCompare(version, 0.5) || qFuzzyCompare(version, 0.7)) {
// 0.7 is unsupported
// qCDebug(KDENLIVE_LOG) << "Unable to open document with version " << version;
KMessageBox::sorry(QApplication::activeWindow(), i18n("This project type is unsupported (version %1) and cannot be loaded.", version),
KMessageBox::error(QApplication::activeWindow(), i18n("This project type is unsupported (version %1) and cannot be loaded.", version),
i18n("Unable to open project"));
return false;
}
......@@ -1257,7 +1257,7 @@ bool DocumentValidator::upgrade(double version, const double currentVersion)
}
}
if (playlist.isNull()) {
KMessageBox::sorry(QApplication::activeWindow(), i18n("Cannot recover this project file"));
KMessageBox::error(QApplication::activeWindow(), i18n("Cannot recover this project file"));
return false;
}
// Migrate document notes
......
......@@ -258,7 +258,7 @@ DocOpenResult KdenliveDoc::Open(const QUrl &url, const QString &projectFolder, Q
doc->m_projectFolder = doc->m_url.toString(QUrl::RemoveFilename | QUrl::RemoveScheme);
folder.setPath(doc->m_projectFolder);
if (folder.exists()) {
KMessageBox::sorry(
KMessageBox::error(
parent,
i18n("The project directory %1, could not be created.\nPlease make sure you have the required permissions.\nDefaulting to system folders",
doc->m_projectFolder));
......@@ -769,7 +769,7 @@ void KdenliveDoc::moveProjectData(const QString & /*src*/, const QString &dest)
void KdenliveDoc::slotMoveFinished(KJob *job)
{
if (job->error() != 0) {
KMessageBox::sorry(pCore->window(), i18n("Error moving project folder: %1", job->errorText()));
KMessageBox::error(pCore->window(), i18n("Error moving project folder: %1", job->errorText()));
}
}
......
......@@ -151,7 +151,7 @@ void EffectListWidget::exportCustomEffect(const QModelIndex &index)
KRecentDirs::add(QStringLiteral(":KdenliveExportCustomEffect"), target.adjusted(QUrl::RemoveFilename).toLocalFile());
KIO::FileCopyJob *copyjob = KIO::file_copy(source, target);
if (!copyjob->exec()) {
KMessageBox::sorry(this, i18n("Unable to write to file %1", target.toLocalFile()));
KMessageBox::error(this, i18n("Unable to write to file %1", target.toLocalFile()));
}
}
}
......@@ -480,7 +480,7 @@ void CollapsibleEffectView::slotSaveEffect()
QString name = effectName->text();
QString enteredDescription = descriptionBox->toPlainText();
if (name.trimmed().isEmpty()) {
KMessageBox::sorry(this, i18n("No name provided, effect not saved."));
KMessageBox::error(this, i18n("No name provided, effect not saved."));
return;
}
QDir dir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QStringLiteral("/effects/"));
......@@ -567,7 +567,7 @@ void CollapsibleEffectView::slotSaveEffect()
#endif
out << doc.toString();
} else {
KMessageBox::sorry(this, i18n("Cannot write to file %1", file.fileName()));
KMessageBox::error(this, i18n("Cannot write to file %1", file.fileName()));
}
file.close();
emit reloadEffect(dir.absoluteFilePath(name + QStringLiteral(".xml")));
......
......@@ -503,12 +503,12 @@ void EffectStackView::slotSaveStack()
}
}
if (m_model->rowCount() <= 1) {
KMessageBox::sorry(this, i18n("No effect selected."));
KMessageBox::error(this, i18n("No effect selected."));
return;
}
QString name = QInputDialog::getText(this, i18nc("@title:window", "Save Effect Stack"), i18n("Name for saved stack: "));
if (name.trimmed().isEmpty()) {
KMessageBox::sorry(this, i18n("No name provided, effect stack not saved."));
KMessageBox::error(this, i18n("No name provided, effect stack not saved."));
return;
}
......
......@@ -217,7 +217,7 @@ void MainWindow::init(const QString &mltPath)
// If using a custom profile, make sure the file exists or fallback to default
QString currentProfilePath = pCore->getCurrentProfilePath();
if (currentProfilePath.startsWith(QLatin1Char('/')) && !QFile::exists(currentProfilePath)) {
KMessageBox::sorry(this, i18n("Cannot find your default profile, switching to ATSC 1080p 25"));
KMessageBox::error(this, i18n("Cannot find your default profile, switching to ATSC 1080p 25"));
pCore->setCurrentProfile(QStringLiteral("atsc_1080p_25"));
KdenliveSettings::setDefault_profile(QStringLiteral("atsc_1080p_25"));
}
......@@ -2073,12 +2073,12 @@ void MainWindow::slotEditProjectSettings()
bool ok;
documentId.toLongLong(&ok, 10);
if (!ok || documentId.isEmpty()) {
KMessageBox::sorry(this, i18n("Cannot perform operation, invalid document id: %1", documentId));
KMessageBox::error(this, i18n("Cannot perform operation, invalid document id: %1", documentId));
} else {
QDir newDir(newProjectFolder);
QDir oldDir(project->projectTempFolder());
if (newDir.exists(documentId)) {
KMessageBox::sorry(this, i18n("Cannot perform operation, target directory already exists: %1", newDir.absoluteFilePath(documentId)));
KMessageBox::error(this, i18n("Cannot perform operation, target directory already exists: %1", newDir.absoluteFilePath(documentId)));
} else {
// Proceed with the move
pCore->projectManager()->moveProjectData(oldDir.absoluteFilePath(documentId), newDir.absolutePath());
......
......@@ -2663,7 +2663,7 @@ void Monitor::slotSwitchRecTimecode(bool enable)
}
if (mediainfopath.isEmpty()) {
// TODO: propose to install mediainfo
KMessageBox::sorry(
KMessageBox::error(
this,
i18n("The MediaInfo application is required for the recording timecode feature, please install it and re-enable the feature in Kdenlive"));
return;
......
......@@ -599,9 +599,9 @@ void ResourceWidget::slotGotFile(KJob *job)
if (job->error() != 0) {
const QString errTxt = job->errorString();
if (job->property("usedOAuth2").toBool()) {
KMessageBox::sorry(this, i18n("%1 Try again.", errTxt), i18n("Error Loading Data"));
KMessageBox::error(this, i18n("%1 Try again.", errTxt), i18n("Error Loading Data"));
} else {
KMessageBox::sorry(this, errTxt, i18n("Error Loading Data"));
KMessageBox::error(this, errTxt, i18n("Error Loading Data"));
}
qCDebug(KDENLIVE_LOG) << "//file import job errored: " << errTxt;
return;
......
......@@ -171,7 +171,7 @@ const QString ProfileRepository::saveProfile(ProfileInfo *profile, QString profi
}
QFile file(profilePath);
if (!file.open(QIODevice::WriteOnly)) {
KMessageBox::sorry(nullptr, i18n("Cannot open file %1", profilePath));
KMessageBox::error(nullptr, i18n("Cannot open file %1", profilePath));
return QString();
}
QTextStream out(&file);
......
......@@ -603,7 +603,7 @@ bool ArchiveWidget::slotStartArchiving(bool firstPass)
} else {
QDir dir(slideFolder.toLocalFile());
if (!dir.mkpath(QStringLiteral("."))) {
KMessageBox::sorry(this, i18n("Cannot create directory %1", slideFolder.toLocalFile()));
KMessageBox::error(this, i18n("Cannot create directory %1", slideFolder.toLocalFile()));
}
}
isSlideshow = true;
......@@ -637,7 +637,7 @@ bool ArchiveWidget::slotStartArchiving(bool firstPass)
} else {
QDir dir(destUrl.toLocalFile());
if (!dir.mkpath(QStringLiteral("."))) {
KMessageBox::sorry(this, i18n("Cannot create directory %1", destUrl.toLocalFile()));
KMessageBox::error(this, i18n("Cannot create directory %1", destUrl.toLocalFile()));
}
QFile file(dir.absoluteFilePath(filename));
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
......@@ -727,7 +727,7 @@ bool ArchiveWidget::slotStartArchiving(bool firstPass)
} else {
QDir dir(destUrl.toLocalFile());
if (!dir.mkpath(QStringLiteral("."))) {
KMessageBox::sorry(this, i18n("Cannot create directory %1", destUrl.toLocalFile()));
KMessageBox::error(this, i18n("Cannot create directory %1", destUrl.toLocalFile()));
}
m_copyJob = KIO::copy(files, destUrl, KIO::HideProgressInfo);
connect(m_copyJob, &KJob::result, this, [this](KJob *jb) { slotArchivingFinished(jb, false); });
......@@ -1140,7 +1140,7 @@ void ArchiveWidget::slotStartExtracting()
m_requestedSize = static_cast<KIO::filesize_t>(f.size());
QDir dir(archive_url->url().toLocalFile());
if (!dir.mkpath(QStringLiteral("."))) {
KMessageBox::sorry(this, i18n("Cannot create directory %1", archive_url->url().toLocalFile()));
KMessageBox::error(this, i18n("Cannot create directory %1", archive_url->url().toLocalFile()));
}
slotDisplayMessage(QStringLiteral("system-run"), i18n("Extracting…"));
buttonBox->button(QDialogButtonBox::Apply)->setText(i18n("Abort"));
......@@ -1208,7 +1208,7 @@ void ArchiveWidget::slotExtractingFinished()
}
}
if (error) {
KMessageBox::sorry(QApplication::activeWindow(), i18n("Cannot open project file %1", extractedProjectFile()), i18n("Cannot open file"));
KMessageBox::error(QApplication::activeWindow(), i18n("Cannot open project file %1", extractedProjectFile()), i18n("Cannot open file"));
reject();
} else {
accept();
......
......@@ -419,12 +419,12 @@ bool ProjectManager::saveFileAs(const QString &outputFileName, bool saveACopy)
bool ok;
documentId.toLongLong(&ok, 10);
if (!ok || documentId.isEmpty()) {
KMessageBox::sorry(pCore->window(), i18n("Cannot perform operation, invalid document id: %1", documentId));
KMessageBox::error(pCore->window(), i18n("Cannot perform operation, invalid document id: %1", documentId));
} else {
QDir newDir(newProjectFolder);
QDir oldDir(m_project->projectTempFolder());
if (newDir.exists(documentId)) {
KMessageBox::sorry(pCore->window(),
KMessageBox::error(pCore->window(),
i18n("Cannot perform operation, target directory already exists: %1", newDir.absoluteFilePath(documentId)));
} else {
// Proceed with the move
......@@ -584,7 +584,7 @@ void ProjectManager::openFile(const QUrl &url)
/*if (!url.fileName().endsWith(".kdenlive")) {
// This is not a Kdenlive project file, abort loading
KMessageBox::sorry(pCore->window(), i18n("File %1 is not a Kdenlive project file", url.toLocalFile()));
KMessageBox::error(pCore->window(), i18n("File %1 is not a Kdenlive project file", url.toLocalFile()));
if (m_startUrl.isValid()) {
// we tried to open an invalid file from command line, init new project
newFile(false);
......@@ -1020,7 +1020,7 @@ void ProjectManager::slotMoveFinished(KJob *job)
m_replacementPattern.clear();
slotRevert();
} else {
KMessageBox::sorry(pCore->window(), i18n("Error moving project folder: %1", job->errorText()));
KMessageBox::error(pCore->window(), i18n("Error moving project folder: %1", job->errorText()));
}
}
......
Supports Markdown
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