mirror of
				https://invent.kde.org/frameworks/kimageformats.git
				synced 2025-11-03 13:24:20 -05:00 
			
		
		
		
	[imagedump] Add "list MIME type" (-m) option
Allows listing the supported mime types
This commit is contained in:
		@ -45,6 +45,10 @@ int main(int argc, char **argv)
 | 
			
		||||
        QStringList() << QStringLiteral("l") << QStringLiteral("list-file-formats"),
 | 
			
		||||
        QStringLiteral("List supported image file formats"));
 | 
			
		||||
    parser.addOption(listformats);
 | 
			
		||||
    QCommandLineOption listmimetypes(
 | 
			
		||||
        QStringList() << QStringLiteral("m") << QStringLiteral("list-mime-types"),
 | 
			
		||||
        QStringLiteral("List supported image mime types"));
 | 
			
		||||
    parser.addOption(listmimetypes);
 | 
			
		||||
    QCommandLineOption listqformats(
 | 
			
		||||
        QStringList() << QStringLiteral("p") << QStringLiteral("list-qimage-formats"),
 | 
			
		||||
        QStringLiteral("List supported QImage data formats"));
 | 
			
		||||
@ -63,6 +67,15 @@ int main(int argc, char **argv)
 | 
			
		||||
        }
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
    if (parser.isSet(listmimetypes)) {
 | 
			
		||||
        QTextStream out(stdout);
 | 
			
		||||
        out << "MIME types:\n";
 | 
			
		||||
        const auto lstSupportedMimeTypes = QImageReader::supportedMimeTypes();
 | 
			
		||||
        for (const auto &fmt : lstSupportedMimeTypes) {
 | 
			
		||||
            out << "  " << fmt << '\n';
 | 
			
		||||
        }
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
    if (parser.isSet(listqformats)) {
 | 
			
		||||
        QTextStream out(stdout);
 | 
			
		||||
        out << "QImage formats:\n";
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user