KShare/formats.cpp
2017-06-13 01:18:18 +02:00

78 lines
1.8 KiB
C++

#include <formats.hpp>
QString formats::normalFormatName(formats::Normal format) {
switch (format) {
case Normal::JPG:
return "JPG";
break;
case Normal::PNG:
return "PNG";
break;
default:
return QString();
break;
}
}
formats::Normal formats::normalFormatFromName(QString format) {
if (format.toLower() == "jpg") return Normal::JPG;
if (format.toLower() == "jpeg") return Normal::JPG;
if (format.toLower() == "png") return Normal::PNG;
return Normal::None;
}
QString formats::normalFormatMIME(formats::Normal format) {
switch (format) {
case Normal::JPG:
return "image/jpeg";
break;
case Normal::PNG:
return "image/png";
break;
default:
return QString();
break;
}
}
QString formats::recordingFormatName(formats::Recording format) {
switch (format) {
case Recording::GIF:
return "GIF";
break;
case Recording::WebM:
return "WEBM";
break;
case Recording::MP4:
return "MP4";
break;
default:
return QString();
break;
}
}
formats::Recording formats::recordingFormatFromName(QString format) {
if (format.toLower() == "gif") return Recording::GIF;
if (format.toLower() == "webm") return Recording::WebM;
if (format.toLower() == "mp4") return Recording::MP4;
return Recording::None;
}
QString formats::recordingFormatMIME(formats::Recording format) {
switch (format) {
case Recording::GIF:
return "image/gif";
break;
case Recording::WebM:
return "video/webm";
break;
case Recording::MP4:
return "video/mp4";
break;
default:
return QString();
break;
}
}