1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-22 10:42:29 +01:00

Make enum checks CaseInsensitive

This commit is contained in:
Elias Steurer 2021-11-13 14:12:52 +01:00
parent b52c89c933
commit 3550391eca

View File

@ -233,7 +233,7 @@ std::optional<ScreenPlay::InstalledType::InstalledType> getInstalledTypeFromStri
{
using ScreenPlay::InstalledType::InstalledType;
if (type.endsWith("Wallpaper")) {
if (type.endsWith("Wallpaper", Qt::CaseInsensitive)) {
if (type.startsWith("video", Qt::CaseInsensitive)) {
return InstalledType::VideoWallpaper;
}
@ -254,7 +254,7 @@ std::optional<ScreenPlay::InstalledType::InstalledType> getInstalledTypeFromStri
}
}
if (type.endsWith("Widget")) {
if (type.endsWith("Widget", Qt::CaseInsensitive)) {
if (type.startsWith("qml", Qt::CaseInsensitive)) {
return InstalledType::QMLWidget;
}
@ -266,28 +266,27 @@ std::optional<ScreenPlay::InstalledType::InstalledType> getInstalledTypeFromStri
return std::nullopt;
}
/*!
\brief Maps the video codec type from a QString to an enum. Used for parsing the project.json.
*/
std::optional<ScreenPlay::VideoCodec::VideoCodec> getVideoCodecFromString(const QString &type)
std::optional<ScreenPlay::VideoCodec::VideoCodec> getVideoCodecFromString(const QString& type)
{
if(type.isEmpty())
if (type.isEmpty())
return std::nullopt;
if(type.contains("vp8",Qt::CaseInsensitive))
if (type.contains("vp8", Qt::CaseInsensitive))
return ScreenPlay::VideoCodec::VideoCodec::VP8;
if(type.contains("vp9",Qt::CaseInsensitive))
if (type.contains("vp9", Qt::CaseInsensitive))
return ScreenPlay::VideoCodec::VideoCodec::VP9;
if(type.contains("av1",Qt::CaseInsensitive))
if (type.contains("av1", Qt::CaseInsensitive))
return ScreenPlay::VideoCodec::VideoCodec::AV1;
if(type.contains("h264",Qt::CaseInsensitive))
if (type.contains("h264", Qt::CaseInsensitive))
return ScreenPlay::VideoCodec::VideoCodec::H264;
if(type.contains("h265",Qt::CaseInsensitive))
if (type.contains("h265", Qt::CaseInsensitive))
return ScreenPlay::VideoCodec::VideoCodec::H264;
return std::nullopt;
@ -395,5 +394,4 @@ std::optional<QVector<int>> parseStringToIntegerList(const QString string)
return list;
}
}