mirror of
				https://invent.kde.org/frameworks/kimageformats.git
				synced 2025-11-03 13:24:20 -05:00 
			
		
		
		
	test: imageconverter: add a way to list mimes instead of formats
This commit is contained in:
		@ -38,6 +38,9 @@ int main(int argc, char **argv)
 | 
			
		||||
    QCommandLineOption listformats(QStringList() << QStringLiteral("l") << QStringLiteral("list"), QStringLiteral("List supported image formats"));
 | 
			
		||||
    parser.addOption(listformats);
 | 
			
		||||
 | 
			
		||||
    QCommandLineOption listmimes(QStringList() << QStringLiteral("m") << QStringLiteral("listmime"), QStringLiteral("List supported image mime formats"));
 | 
			
		||||
    parser.addOption(listmimes);
 | 
			
		||||
 | 
			
		||||
    parser.process(app);
 | 
			
		||||
 | 
			
		||||
    const QStringList files = parser.positionalArguments();
 | 
			
		||||
@ -57,6 +60,21 @@ int main(int argc, char **argv)
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (parser.isSet(listmimes)) {
 | 
			
		||||
        QTextStream out(stdout);
 | 
			
		||||
        out << "Input mime formats:\n";
 | 
			
		||||
        const auto lstReaderSupportedMimes = QImageReader::supportedMimeTypes();
 | 
			
		||||
        for (const QByteArray &fmt : lstReaderSupportedMimes) {
 | 
			
		||||
            out << "  " << fmt << '\n';
 | 
			
		||||
        }
 | 
			
		||||
        out << "Output mime formats:\n";
 | 
			
		||||
        const auto lstWriterSupportedMimes = QImageWriter::supportedMimeTypes();
 | 
			
		||||
        for (const QByteArray &fmt : lstWriterSupportedMimes) {
 | 
			
		||||
            out << "  " << fmt << '\n';
 | 
			
		||||
        }
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (files.count() != 2) {
 | 
			
		||||
        QTextStream(stdout) << "Must provide exactly two files\n";
 | 
			
		||||
        parser.showHelp(1);
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user