KMimeType > QMimeType

parent 10010875
......@@ -36,7 +36,7 @@ QStringList SamplePlugin::generators(const QStringList &producers) const
}
KUrl SamplePlugin::generatedClip(const QString &renderer, const QString &generator, const KUrl &projectFolder, const QStringList &/*lumaNames*/, const QStringList &/*lumaFiles*/, const double fps, const int /*width*/, const int height)
QUrl SamplePlugin::generatedClip(const QString &renderer, const QString &generator, const QUrl &projectFolder, const QStringList &/*lumaNames*/, const QStringList &/*lumaFiles*/, const double fps, const int /*width*/, const int height)
{
QString prePath;
if (generator == i18n("Noise")) {
......@@ -64,8 +64,8 @@ KUrl SamplePlugin::generatedClip(const QString &renderer, const QString &generat
view.path->setMode(KFile::File);
QString clipFile = prePath + counter + QLatin1String(".mlt");
view.path->setUrl(KUrl(clipFile));
KUrl result;
view.path->setUrl(QUrl(clipFile));
QUrl result;
if (d->exec() == QDialog::Accepted) {
QProcess generatorProcess;
......
......@@ -35,7 +35,7 @@ class SamplePlugin : public QObject, public ClipGenerator
public:
QStringList generators(const QStringList &producers = QStringList()) const;
KUrl generatedClip(const QString &renderer, const QString &generator, const KUrl &projectFolder, const QStringList &lumaNames, const QStringList &lumaFiles, const double fps, const int width, const int height);
QUrl generatedClip(const QString &renderer, const QString &generator, const QUrl &projectFolder, const QStringList &lumaNames, const QStringList &lumaFiles, const double fps, const int width, const int height);
};
......
......@@ -33,16 +33,17 @@
#include <KLocalizedString>
#include <KProcess>
#include <kmimetype.h>
#include <KRun>
#include <KMessageWidget>
#include <KStandardDirs>
#include <QLabel>
#include <QMimeType>
#include <QFile>
#include <QXmlStreamWriter>
#include <QTimer>
#include <QStandardPaths>
#include <QMimeDatabase>
#include <QDebug>
// Recommended MLT version
......@@ -558,21 +559,23 @@ void Wizard::slotCheckPrograms()
void Wizard::installExtraMimes(const QString &baseName, const QStringList &globs)
{
QMimeDatabase db;
QString mimefile = baseName;
mimefile.replace('/', '-');
KMimeType::Ptr mime = KMimeType::mimeType(baseName);
QMimeType mime = db.mimeTypeForName(baseName);
QStringList missingGlobs;
foreach(const QString & glob, globs) {
KMimeType::Ptr type = KMimeType::findByPath(glob, 0, true);
QString mimeName = type->name();
QMimeType type = db.mimeTypeForFile(glob, QMimeDatabase::MatchExtension);
QString mimeName = type.name();
if (!mimeName.contains("audio") && !mimeName.contains("video")) missingGlobs << glob;
}
if (missingGlobs.isEmpty()) return;
if (!mime) {
//qDebug() << "KMimeTypeTrader: mimeType " << baseName << " not found";
if (!mime.isValid() || mime.isDefault()) {
qDebug() << "mimeType " << baseName << " not found";
} else {
QStringList extensions = mime->patterns();
QString comment = mime->comment();
QStringList extensions = mime.globPatterns();
QString comment = mime.comment();
foreach(const QString & glob, missingGlobs) {
if (!extensions.contains(glob)) extensions << glob;
}
......
......@@ -28,7 +28,6 @@
#include <KLocalizedString>
#include <kmimetype.h>
#include <KMessageBox>
#include <QFile>
......
......@@ -44,9 +44,8 @@
#include <QGraphicsItemGroup>
#include <QtConcurrent>
#include <QApplication>
#include <QMimeType>
#include <KFileMetaInfo>
#include <KMimeType>
#include <KJobWidgets/KJobWidgets>
ClipManager::ClipManager(KdenliveDoc *doc) :
......@@ -569,15 +568,18 @@ void ClipManager::slotAddClipList(const QList<QUrl> &urls, const QMap <QString,
}
if (data.contains("video_index")) prod.setAttribute("video_index", data.value("video_index"));
if (data.contains("audio_index")) prod.setAttribute("audio_index", data.value("audio_index"));
KMimeType::Ptr type = KMimeType::findByUrl(file);
if (type->name().startsWith(QLatin1String("image/"))) {
QMimeDatabase db;
QMimeType type = db.mimeTypeForUrl(file);
if (type.name().startsWith(QLatin1String("image/"))) {
prod.setAttribute("type", (int) Image);
prod.setAttribute("in", 0);
prod.setAttribute("out", m_doc->getFramePos(KdenliveSettings::image_duration()) - 1);
if (KdenliveSettings::autoimagetransparency()) prod.setAttribute("transparency", 1);
// Read EXIF metadata for JPEG
if (type->is("image/jpeg")) {
if (type.inherits("image/jpeg")) {
//TODO KF5 how to read metadata?
/*
KFileMetaInfo metaInfo(file.path(), QString("image/jpeg"), KFileMetaInfo::TechnicalInfo);
const QHash<QString, KFileMetaInfoItem> metaInfoItems = metaInfo.items();
foreach(const KFileMetaInfoItem & metaInfoItem, metaInfoItems) {
......@@ -587,9 +589,9 @@ void ClipManager::slotAddClipList(const QList<QUrl> &urls, const QMap <QString,
meta.setAttribute("tool", "KDE Metadata");
meta.appendChild(value);
prod.appendChild(meta);
}
}*/
}
} else if (type->is("application/x-kdenlivetitle")) {
} else if (type.inherits("application/x-kdenlivetitle")) {
// opening a title file
QDomDocument txtdoc("titledocument");
QFile txtfile(file.path());
......
......@@ -21,8 +21,6 @@
#include "backupwidget.h"
#include "kdenlivesettings.h"
#include <KUrl>
BackupWidget::BackupWidget(const QUrl &projectUrl, const QUrl &projectFolder, const QString &projectId, QWidget * parent) :
QDialog(parent)
......@@ -65,9 +63,8 @@ BackupWidget::~BackupWidget()
void BackupWidget::slotParseBackupFiles()
{
QStringList filter;
KUrl backupFile = project_url->url();
backupFile.addPath(".backup/");
QDir dir(backupFile.path());
QDir dir(project_url->url().path());
dir.cd(".backup");
filter << m_projectWildcard;
dir.setNameFilters(filter);
......
......@@ -23,7 +23,6 @@
#include <KFileItem>
#include <kdeversion.h>
#include <QDebug>
#include <QFontDatabase>
......
......@@ -55,7 +55,6 @@
#include <KActionCollection>
#include <KVBox>
#include <KHBox>
#include <KMimeType>
#include <KPassivePopup>
#include <KGlobalSettings>
#include <KStandardDirs>
......@@ -1677,11 +1676,12 @@ QStringList ProjectList::getExtensions()
// Image mimes
mimeTypes << "image/gif" << "image/jpeg" << "image/png" << "image/x-tga" << "image/x-bmp" << "image/svg+xml" << "image/tiff" << "image/x-xcf" << "image/x-xcf-gimp" << "image/x-vnd.adobe.photoshop" << "image/x-pcx" << "image/x-exr" << "image/x-portable-pixmap";
QMimeDatabase db;
QStringList allExtensions;
foreach(const QString & mimeType, mimeTypes) {
KMimeType::Ptr mime(KMimeType::mimeType(mimeType));
if (mime) {
allExtensions.append(mime->patterns());
QMimeType mime = db.mimeTypeForName(mimeType);
if (mime.isValid()) {
allExtensions.append(mime.globPatterns());
}
}
allExtensions.removeDuplicates();
......@@ -1770,11 +1770,11 @@ void ProjectList::slotAddClip(const QList <QUrl> &givenList, const QString &grou
list << givenList.at(i);
}
QList < QList<QUrl> > foldersList;
QMimeDatabase db;
foreach(const QUrl & file, list) {
// Check there is no folder here
KMimeType::Ptr type = KMimeType::findByUrl(file);
if (type->is("inode/directory")) {
QMimeType type = db.mimeTypeForUrl(file);
if (type.inherits("inode/directory")) {
// user dropped a folder, import its files
list.removeAll(file);
QDir dir(file.path());
......
......@@ -27,12 +27,12 @@ the Free Software Foundation, either version 3 of the License, or
#include <QAction>
#include <KMessageBox>
#include <KProgressDialog>
#include <KMimeType>
#include <QCryptographicHash>
#include <QFileDialog>
#include <QDebug>
#include <QMimeDatabase>
#include <QMimeType>
ProjectManager::ProjectManager(QObject* parent) :
QObject(parent),
......@@ -285,9 +285,10 @@ void ProjectManager::openLastFile()
void ProjectManager::openFile(const QUrl &url)
{
QMimeDatabase db;
// Make sure the url is a Kdenlive project file
KMimeType::Ptr mime = KMimeType::findByUrl(url);
if (mime.data()->is("application/x-compressed-tar")) {
QMimeType mime = db.mimeTypeForUrl(url);
if (mime.inherits("application/x-compressed-tar")) {
// Opening a compressed project file, we need to process it
//qDebug()<<"Opening archive, processing";
QPointer<ArchiveWidget> ar = new ArchiveWidget(url);
......@@ -445,9 +446,11 @@ void ProjectManager::slotRevert()
QString ProjectManager::getMimeType(bool open)
{
QMimeDatabase db;
QString mimetype = "application/x-kdenlive";
KMimeType::Ptr mime = KMimeType::mimeType(mimetype);
if (!mime) {
QMimeType mime = db.mimeTypeForName(mimetype);
if (!mime.isValid()) {
mimetype = "*.kdenlive";
if (open) mimetype.append(" *.tar.gz");
}
......
......@@ -28,8 +28,6 @@
#include <krandomsequence.h>
#include <QDebug>
#include <ktempdir.h>
#include <kurl.h>
#include <unistd.h>
......
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