Commit 9e4a9b68 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Rename KisImportExporterManager::mimeFilter to supportedMimeTypes

This fits with the QImageReader/Writer API and makes clear the
function returns more than one mimetype.
parent 3d0d9a78
......@@ -159,7 +159,7 @@ QFuture<KisImportExportFilter::ConversionStatus> KisImportExportManager::exportD
// The static method to figure out to which parts of the
// graph this mimetype has a connection to.
QStringList KisImportExportManager::mimeFilter(Direction direction)
QStringList KisImportExportManager::supportedMimeTypes(Direction direction)
{
// Find the right mimetype by the extension
QSet<QString> mimeTypes;
......
......@@ -98,7 +98,7 @@ public:
* information here.
* Optionally, @p extraNativeMimeTypes are added after the native mimetype.
*/
static QStringList mimeFilter(Direction direction);
static QStringList supportedMimeTypes(Direction direction);
/**
* @brief filterForMimeType loads the relevant import/export plugin and returns it. The caller
......
......@@ -893,7 +893,7 @@ QStringList KisMainWindow::showOpenFileDialog(bool isImporting)
{
KoFileDialog dialog(this, KoFileDialog::ImportFiles, "OpenDocument");
dialog.setDefaultDir(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation));
dialog.setMimeTypeFilters(KisImportExportManager::mimeFilter(KisImportExportManager::Import));
dialog.setMimeTypeFilters(KisImportExportManager::supportedMimeTypes(KisImportExportManager::Import));
dialog.setCaption(isImporting ? i18n("Import Images") : i18n("Open Images"));
return dialog.filenames();
......@@ -1026,9 +1026,9 @@ bool KisMainWindow::saveDocument(KisDocument *document, bool saveas, bool isExpo
QUrl suggestedURL = document->url();
QStringList mimeFilter = KisImportExportManager::mimeFilter(KisImportExportManager::Export);
QStringList mimeFilter = KisImportExportManager::supportedMimeTypes(KisImportExportManager::Export);
mimeFilter = KisImportExportManager::mimeFilter(KisImportExportManager::Export);
mimeFilter = KisImportExportManager::supportedMimeTypes(KisImportExportManager::Export);
if (!mimeFilter.contains(oldMimeFormat)) {
dbgUI << "KisMainWindow::saveDocument no export filter for" << oldMimeFormat;
......@@ -1390,7 +1390,7 @@ void KisMainWindow::switchTab(int index)
void KisMainWindow::slotFileNew()
{
const QStringList mimeFilter = KisImportExportManager::mimeFilter(KisImportExportManager::Import);
const QStringList mimeFilter = KisImportExportManager::supportedMimeTypes(KisImportExportManager::Import);
KisOpenPane *startupWidget = new KisOpenPane(this, mimeFilter, QStringLiteral("templates/"));
startupWidget->setWindowModality(Qt::WindowModal);
......
......@@ -43,7 +43,7 @@ KisDlgFileLayer::KisDlgFileLayer(const QString &basePath, const QString & name,
setDefaultButton(Ok);
QWidget * page = new QWidget(this);
dlgWidget.setupUi(page);
QStringList mimes = KisImportExportManager::mimeFilter(KisImportExportManager::Import);
QStringList mimes = KisImportExportManager::supportedMimeTypes(KisImportExportManager::Import);
// Nesting .kra files is not supported, so do not offer that option. See https://bugs.kde.org/show_bug.cgi?id=386515
mimes.removeAll("application/x-krita");
dlgWidget.wdgUrlRequester->setMimeTypeFilters(mimes);
......
......@@ -121,7 +121,7 @@ QStringList KisDlgImportImageSequence::showOpenFileDialog()
{
KoFileDialog dialog(this, KoFileDialog::ImportFiles, "OpenDocument");
dialog.setDefaultDir(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation));
dialog.setMimeTypeFilters(KisImportExportManager::mimeFilter(KisImportExportManager::Import));
dialog.setMimeTypeFilters(KisImportExportManager::supportedMimeTypes(KisImportExportManager::Import));
dialog.setCaption(i18n("Import Images"));
return dialog.filenames();
......
......@@ -117,7 +117,7 @@ qint32 KisImageManager::importImage(const QUrl &urlArg, const QString &layerType
KoFileDialog dialog(m_view->mainWindow(), KoFileDialog::OpenFiles, "OpenDocument");
dialog.setCaption(i18n("Import Image"));
dialog.setDefaultDir(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation));
dialog.setMimeTypeFilters(KisImportExportManager::mimeFilter(KisImportExportManager::Import));
dialog.setMimeTypeFilters(KisImportExportManager::supportedMimeTypes(KisImportExportManager::Import));
QStringList fileNames = dialog.filenames();
Q_FOREACH (const QString &fileName, fileNames) {
urls << QUrl::fromLocalFile(fileName);
......
......@@ -472,7 +472,7 @@ void KisLayerManager::convertLayerToFileLayer(KisNodeSP source)
KisImageSP image = m_view->image();
if (!image) return;
QStringList listMimeFilter = KisImportExportManager::mimeFilter(KisImportExportManager::Export);
QStringList listMimeFilter = KisImportExportManager::supportedMimeTypes(KisImportExportManager::Export);
KoDialog dlg;
QWidget *page = new QWidget(&dlg);
......@@ -833,7 +833,7 @@ void KisLayerManager::layersUpdated()
void KisLayerManager::saveGroupLayers()
{
QStringList listMimeFilter = KisImportExportManager::mimeFilter(KisImportExportManager::Export);
QStringList listMimeFilter = KisImportExportManager::supportedMimeTypes(KisImportExportManager::Export);
KoDialog dlg;
QWidget *page = new QWidget(&dlg);
......
......@@ -1016,7 +1016,7 @@ void KisNodeManager::Private::saveDeviceAsImage(KisPaintDeviceSP device,
KoFileDialog dialog(view->mainWindow(), KoFileDialog::SaveFile, "savenodeasimage");
dialog.setCaption(i18n("Export \"%1\"", defaultName));
dialog.setDefaultDir(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation));
dialog.setMimeTypeFilters(KisImportExportManager::mimeFilter(KisImportExportManager::Export));
dialog.setMimeTypeFilters(KisImportExportManager::supportedMimeTypes(KisImportExportManager::Export));
QString filename = dialog.filename();
if (filename.isEmpty()) return;
......
......@@ -105,7 +105,7 @@ void KisPresetSaveWidget::loadImageFromFile()
{
// create a dialog to retrieve an image file.
KoFileDialog dialog(0, KoFileDialog::OpenFile, "OpenDocument");
dialog.setMimeTypeFilters(KisImportExportManager::mimeFilter(KisImportExportManager::Import));
dialog.setMimeTypeFilters(KisImportExportManager::supportedMimeTypes(KisImportExportManager::Import));
dialog.setDefaultDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
QString filename = dialog.filename(); // the filename() returns the entire path & file name, not just the file name
......
......@@ -104,7 +104,7 @@ DlgAnimationRenderer::DlgAnimationRenderer(KisDocument *doc, QWidget *parent)
m_page->chkIncludeAudio->setEnabled(hasAudio);
m_page->chkIncludeAudio->setChecked(hasAudio && !doc->image()->animationInterface()->isAudioMuted());
QStringList mimes = KisImportExportManager::mimeFilter(KisImportExportManager::Export);
QStringList mimes = KisImportExportManager::supportedMimeTypes(KisImportExportManager::Export);
mimes.sort();
Q_FOREACH(const QString &mime, mimes) {
QString description = KisMimeDatabase::descriptionForMimeType(mime);
......
......@@ -98,7 +98,7 @@ void Imagesplit::slotImagesplit()
QString suffix = strList.at(0);
// Getting all mime types and converting them into names which are displayed at combo box
QStringList listMimeFilter = KisImportExportManager::mimeFilter(KisImportExportManager::Export);
QStringList listMimeFilter = KisImportExportManager::supportedMimeTypes(KisImportExportManager::Export);
QString defaultMime = QString::fromLatin1(viewManager()->document()->mimeType());
int defaultMimeIndex = 0;
......@@ -139,7 +139,7 @@ void Imagesplit::slotImagesplit()
KoFileDialog dialog(viewManager()->mainWindow(), KoFileDialog::OpenDirectory, "OpenDocument");
dialog.setCaption(i18n("Save Image on Split"));
dialog.setDefaultDir(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation));
QStringList mimeFilter = viewManager()->document()->importExportManager()->mimeFilter(KisImportExportManager::Export);
QStringList mimeFilter = viewManager()->document()->importExportManager()->supportedMimeTypes(KisImportExportManager::Export);
QString defaultMime = QString::fromLatin1(viewManager()->document()->mimeType());
dialog.setMimeTypeFilters(mimeFilter, defaultMime);
......
......@@ -427,7 +427,7 @@ void DlgCreateBundle::getPreviewImage()
KoFileDialog dialog(this, KoFileDialog::OpenFile, "BundlePreviewImage");
dialog.setCaption(i18n("Select file to use as bundle icon"));
dialog.setDefaultDir(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation));
dialog.setMimeTypeFilters(KisImportExportManager::mimeFilter(KisImportExportManager::Import));
dialog.setMimeTypeFilters(KisImportExportManager::supportedMimeTypes(KisImportExportManager::Import));
m_previewImage = dialog.filename();
QImage img(m_previewImage);
img = img.scaled(256, 256, Qt::KeepAspectRatio, Qt::SmoothTransformation);
......
......@@ -237,7 +237,7 @@ void KisChannelSeparator::separate(KoUpdater * progressUpdater, enumSepAlphaOpti
KoFileDialog dialog(m_viewManager->mainWindow(), KoFileDialog::SaveFile, "OpenDocument");
dialog.setCaption(i18n("Export Layer") + '(' + ch->name() + ')');
dialog.setDefaultDir(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation));
dialog.setMimeTypeFilters(KisImportExportManager::mimeFilter(KisImportExportManager::Export));
dialog.setMimeTypeFilters(KisImportExportManager::supportedMimeTypes(KisImportExportManager::Export));
QUrl url = QUrl::fromUserInput(dialog.filename());
if (url.isEmpty())
......
......@@ -41,7 +41,7 @@ KisWdgFastColorTransfer::KisWdgFastColorTransfer(QWidget * parent) : KisConfigWi
{
m_widget = new Ui_WdgFastColorTransfer();
m_widget->setupUi(this);
m_widget->fileNameURLRequester->setMimeTypeFilters(KisImportExportManager::mimeFilter(KisImportExportManager::Import));
m_widget->fileNameURLRequester->setMimeTypeFilters(KisImportExportManager::supportedMimeTypes(KisImportExportManager::Import));
connect(m_widget->fileNameURLRequester, SIGNAL(textChanged(const QString&)), this, SIGNAL(sigConfigurationItemChanged()));
}
......
......@@ -805,7 +805,7 @@ KisNodeSP KisKraLoader::loadFileLayer(const KoXmlElement& element, KisImageSP im
if (result == QMessageBox::Yes) {
KoFileDialog dialog(0, KoFileDialog::OpenFile, "OpenDocument");
dialog.setMimeTypeFilters(KisImportExportManager::mimeFilter(KisImportExportManager::Import));
dialog.setMimeTypeFilters(KisImportExportManager::supportedMimeTypes(KisImportExportManager::Import));
dialog.setDefaultDir(basePath);
QString url = dialog.filename();
......
......@@ -33,7 +33,7 @@ public:
KisShapeOptionsWidget(QWidget *parent = 0)
: QWidget(parent) {
setupUi(this);
imageUrl->setMimeTypeFilters(KisImportExportManager::mimeFilter(KisImportExportManager::Import));
imageUrl->setMimeTypeFilters(KisImportExportManager::supportedMimeTypes(KisImportExportManager::Import));
}
};
......
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