Adapt to c++utilities v5
This commit is contained in:
parent
258ebe7255
commit
1691b9daa2
|
@ -169,26 +169,26 @@ set(REQUIRED_ICONS
|
||||||
view-media-lyrics)
|
view-media-lyrics)
|
||||||
|
|
||||||
# find c++utilities
|
# find c++utilities
|
||||||
find_package(c++utilities 4.17.0 REQUIRED)
|
set(CONFIGURATION_PACKAGE_SUFFIX "" CACHE STRING "sets the suffix for find_package() calls to packages configured via c++utilities")
|
||||||
|
find_package(c++utilities${CONFIGURATION_PACKAGE_SUFFIX} 5.0.0 REQUIRED)
|
||||||
use_cpp_utilities()
|
use_cpp_utilities()
|
||||||
include(BasicConfig)
|
include(BasicConfig)
|
||||||
|
|
||||||
# find qtutilities
|
# find qtutilities
|
||||||
if (WIDGETS_GUI OR QUICK_GUI)
|
if (WIDGETS_GUI OR QUICK_GUI)
|
||||||
find_package(qtutilities 5.7.0 REQUIRED)
|
find_package(qtutilities${CONFIGURATION_PACKAGE_SUFFIX} 6.0.0 REQUIRED)
|
||||||
use_qt_utilities()
|
use_qt_utilities()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# find tagparser
|
# find tagparser
|
||||||
find_package(tagparser 8.3.0 REQUIRED)
|
find_package(tagparser${CONFIGURATION_PACKAGE_SUFFIX} 9.0.0 REQUIRED)
|
||||||
use_tag_parser()
|
use_tag_parser()
|
||||||
list(APPEND TEST_LIBRARIES ${TAG_PARSER_SHARED_LIB})
|
|
||||||
|
|
||||||
# enable experimental JSON export
|
# enable experimental JSON export
|
||||||
option(ENABLE_JSON_EXPORT "enable JSON export" OFF)
|
option(ENABLE_JSON_EXPORT "enable JSON export" OFF)
|
||||||
if (ENABLE_JSON_EXPORT)
|
if (ENABLE_JSON_EXPORT)
|
||||||
# find reflective-rapidjson
|
# find reflective-rapidjson
|
||||||
find_package(reflective_rapidjson REQUIRED)
|
find_package(reflective_rapidjson${CONFIGURATION_PACKAGE_SUFFIX} REQUIRED)
|
||||||
use_reflective_rapidjson()
|
use_reflective_rapidjson()
|
||||||
|
|
||||||
# add additional source files
|
# add additional source files
|
||||||
|
@ -204,20 +204,20 @@ if (ENABLE_JSON_EXPORT)
|
||||||
OUTPUT_LISTS
|
OUTPUT_LISTS
|
||||||
HEADER_FILES
|
HEADER_FILES
|
||||||
CLANG_OPTIONS_FROM_TARGETS
|
CLANG_OPTIONS_FROM_TARGETS
|
||||||
tageditor)
|
${META_TARGET_NAME})
|
||||||
|
|
||||||
# add compile definitions
|
# add compile definitions
|
||||||
list(APPEND META_PRIVATE_COMPILE_DEFINITIONS ${META_PROJECT_VARNAME_UPPER}_JSON_EXPORT)
|
list(APPEND META_PRIVATE_COMPILE_DEFINITIONS ${META_PROJECT_VARNAME_UPPER}_JSON_EXPORT)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# add Qt modules which can currently not be detected automatically
|
# add Qt modules which can not be detected automatically
|
||||||
list(APPEND ADDITIONAL_QT_MODULES Concurrent Network)
|
list(APPEND ADDITIONAL_QT_MODULES Concurrent Network)
|
||||||
|
|
||||||
# include modules to apply configuration
|
# include modules to apply configuration
|
||||||
if (WIDGETS_GUI OR QUICK_GUI)
|
if (WIDGETS_GUI OR QUICK_GUI)
|
||||||
include(QtGuiConfig)
|
include(QtGuiConfig)
|
||||||
include(JsProviderConfig)
|
include(QtJsProviderConfig)
|
||||||
include(WebViewProviderConfig)
|
include(QtWebViewProviderConfig)
|
||||||
include(QtConfig)
|
include(QtConfig)
|
||||||
endif ()
|
endif ()
|
||||||
include(WindowsResources)
|
include(WindowsResources)
|
||||||
|
@ -230,10 +230,10 @@ include(ConfigHeader)
|
||||||
add_desktop_file()
|
add_desktop_file()
|
||||||
|
|
||||||
# create custom desktop file for launching the renaming utility separately
|
# create custom desktop file for launching the renaming utility separately
|
||||||
add_custom_desktop_file("${META_PROJECT_NAME}-renamingutility"
|
add_custom_desktop_file(FILE_NAME "${META_ID}-renamingutility"
|
||||||
"Renaming utility (${META_APP_NAME})"
|
DESKTOP_FILE_APP_NAME "Renaming utility (${META_APP_NAME})"
|
||||||
"Renaming utility (${META_APP_NAME})"
|
DESKTOP_FILE_GENERIC_NAME "Renaming utility (${META_APP_NAME})"
|
||||||
"Tool to rename files using its tag information"
|
DESKTOP_FILE_DESCRIPTION "Tool to rename files using its tag information"
|
||||||
"${META_APP_CATEGORIES}"
|
DESKTOP_FILE_CATEGORIES "${META_APP_CATEGORIES}"
|
||||||
"${META_PROJECT_NAME} qt-gui --renaming-utility"
|
DESKTOP_FILE_CMD "${META_TARGET_NAME} qt-gui --renaming-utility"
|
||||||
"${META_PROJECT_NAME}")
|
DESKTOP_FILE_ICON "${META_PROJECT_NAME}")
|
||||||
|
|
|
@ -146,7 +146,7 @@ void restore()
|
||||||
default:
|
default:
|
||||||
v.tagPocessing.creationSettings.id3v2usage = TagUsage::Always;
|
v.tagPocessing.creationSettings.id3v2usage = TagUsage::Always;
|
||||||
};
|
};
|
||||||
v.tagPocessing.creationSettings.id3v2MajorVersion = static_cast<byte>(settings.value(QStringLiteral("versiontobeused")).toUInt());
|
v.tagPocessing.creationSettings.id3v2MajorVersion = static_cast<std::uint8_t>(settings.value(QStringLiteral("versiontobeused")).toUInt());
|
||||||
if (v.tagPocessing.creationSettings.id3v2MajorVersion < 1 || v.tagPocessing.creationSettings.id3v2MajorVersion > 4) {
|
if (v.tagPocessing.creationSettings.id3v2MajorVersion < 1 || v.tagPocessing.creationSettings.id3v2MajorVersion > 4) {
|
||||||
v.tagPocessing.creationSettings.id3v2MajorVersion = 3;
|
v.tagPocessing.creationSettings.id3v2MajorVersion = 3;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
#include "./knownfieldmodel.h"
|
#include "./knownfieldmodel.h"
|
||||||
#include "./targetlevelmodel.h"
|
#include "./targetlevelmodel.h"
|
||||||
|
|
||||||
#include <c++utilities/conversion/types.h>
|
|
||||||
|
|
||||||
#include <tagparser/abstractcontainer.h>
|
#include <tagparser/abstractcontainer.h>
|
||||||
#include <tagparser/settings.h>
|
#include <tagparser/settings.h>
|
||||||
#include <tagparser/tag.h>
|
#include <tagparser/tag.h>
|
||||||
|
|
|
@ -20,7 +20,7 @@ void AttachmentInfo::parseDenotation(const char *denotation)
|
||||||
{
|
{
|
||||||
if (!strncmp(denotation, "id=", 3)) {
|
if (!strncmp(denotation, "id=", 3)) {
|
||||||
try {
|
try {
|
||||||
id = stringToNumber<uint64, string>(denotation + 3);
|
id = stringToNumber<std::uint64_t, string>(denotation + 3);
|
||||||
hasId = true;
|
hasId = true;
|
||||||
} catch (const ConversionException &) {
|
} catch (const ConversionException &) {
|
||||||
cerr << "The specified attachment ID \"" << (denotation + 3) << "\" is invalid.";
|
cerr << "The specified attachment ID \"" << (denotation + 3) << "\" is invalid.";
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
|
|
||||||
#include <tagparser/diagnostics.h>
|
#include <tagparser/diagnostics.h>
|
||||||
|
|
||||||
#include <c++utilities/conversion/types.h>
|
|
||||||
|
|
||||||
namespace TagParser {
|
namespace TagParser {
|
||||||
class AbstractContainer;
|
class AbstractContainer;
|
||||||
class AbstractAttachment;
|
class AbstractAttachment;
|
||||||
|
@ -24,7 +22,7 @@ public:
|
||||||
bool next(TagParser::AbstractContainer *container, TagParser::Diagnostics &diag);
|
bool next(TagParser::AbstractContainer *container, TagParser::Diagnostics &diag);
|
||||||
|
|
||||||
AttachmentAction action;
|
AttachmentAction action;
|
||||||
uint64 id;
|
std::uint64_t id;
|
||||||
bool hasId;
|
bool hasId;
|
||||||
const char *path;
|
const char *path;
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
|
@ -388,14 +388,14 @@ ElementPosition parsePositionDenotation(const Argument &posArg, const Argument &
|
||||||
return defaultPos;
|
return defaultPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64 parseUInt64(const Argument &arg, uint64 defaultValue)
|
std::uint64_t parseUInt64(const Argument &arg, std::uint64_t defaultValue)
|
||||||
{
|
{
|
||||||
if (arg.isPresent()) {
|
if (arg.isPresent()) {
|
||||||
try {
|
try {
|
||||||
if (*arg.values().front() == '0' && *(arg.values().front() + 1) == 'x') {
|
if (*arg.values().front() == '0' && *(arg.values().front() + 1) == 'x') {
|
||||||
return stringToNumber<uint64>(arg.values().front() + 2, 16);
|
return stringToNumber<std::uint64_t>(arg.values().front() + 2, 16);
|
||||||
} else {
|
} else {
|
||||||
return stringToNumber<uint64>(arg.values().front());
|
return stringToNumber<std::uint64_t>(arg.values().front());
|
||||||
}
|
}
|
||||||
} catch (const ConversionException &) {
|
} catch (const ConversionException &) {
|
||||||
cerr << Phrases::Error << "The specified value \"" << arg.values().front() << "\" is no valid unsigned integer." << Phrases::EndFlush;
|
cerr << Phrases::Error << "The specified value \"" << arg.values().front() << "\" is no valid unsigned integer." << Phrases::EndFlush;
|
||||||
|
@ -427,7 +427,7 @@ bool applyTargetConfiguration(TagTarget &target, const std::string &configStr)
|
||||||
if (!configStr.empty()) {
|
if (!configStr.empty()) {
|
||||||
if (configStr.compare(0, 13, "target-level=") == 0) {
|
if (configStr.compare(0, 13, "target-level=") == 0) {
|
||||||
try {
|
try {
|
||||||
target.setLevel(stringToNumber<uint64>(configStr.substr(13)));
|
target.setLevel(stringToNumber<std::uint64_t>(configStr.substr(13)));
|
||||||
} catch (const ConversionException &) {
|
} catch (const ConversionException &) {
|
||||||
cerr << Phrases::Error << "The specified target level \"" << configStr.substr(13) << "\" is invalid." << Phrases::End
|
cerr << Phrases::Error << "The specified target level \"" << configStr.substr(13) << "\" is invalid." << Phrases::End
|
||||||
<< "note: The target level must be an unsigned integer." << endl;
|
<< "note: The target level must be an unsigned integer." << endl;
|
||||||
|
@ -512,7 +512,7 @@ FieldDenotations parseFieldDenotations(const Argument &fieldsArg, bool readOnly)
|
||||||
} else if (!strncmp(fieldDenotationString, "track-id=", 9)) {
|
} else if (!strncmp(fieldDenotationString, "track-id=", 9)) {
|
||||||
const vector<string> parts = splitString<vector<string>>(fieldDenotationString + 9, ",", EmptyPartsTreat::Omit);
|
const vector<string> parts = splitString<vector<string>>(fieldDenotationString + 9, ",", EmptyPartsTreat::Omit);
|
||||||
bool allTracks = false;
|
bool allTracks = false;
|
||||||
vector<uint64> trackIds;
|
vector<std::uint64_t> trackIds;
|
||||||
trackIds.reserve(parts.size());
|
trackIds.reserve(parts.size());
|
||||||
for (const auto &part : parts) {
|
for (const auto &part : parts) {
|
||||||
if (part == "all" || part == "any") {
|
if (part == "all" || part == "any") {
|
||||||
|
@ -520,7 +520,7 @@ FieldDenotations parseFieldDenotations(const Argument &fieldsArg, bool readOnly)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
trackIds.emplace_back(stringToNumber<uint64>(part));
|
trackIds.emplace_back(stringToNumber<std::uint64_t>(part));
|
||||||
} catch (const ConversionException &) {
|
} catch (const ConversionException &) {
|
||||||
cerr << Phrases::Error << "The value provided with the \"track\"-specifier is invalid." << Phrases::End
|
cerr << Phrases::Error << "The value provided with the \"track\"-specifier is invalid." << Phrases::End
|
||||||
<< "note: It must be a comma-separated list of track IDs." << endl;
|
<< "note: It must be a comma-separated list of track IDs." << endl;
|
||||||
|
|
|
@ -121,7 +121,7 @@ struct FieldScope {
|
||||||
TagType tagType;
|
TagType tagType;
|
||||||
TagTarget tagTarget;
|
TagTarget tagTarget;
|
||||||
bool allTracks;
|
bool allTracks;
|
||||||
std::vector<uint64> trackIds;
|
std::vector<std::uint64_t> trackIds;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline FieldScope::FieldScope(KnownField field, TagType tagType, TagTarget tagTarget)
|
inline FieldScope::FieldScope(KnownField field, TagType tagType, TagTarget tagTarget)
|
||||||
|
@ -208,7 +208,7 @@ template <> struct hash<TagTarget> {
|
||||||
std::size_t operator()(const TagTarget &target) const
|
std::size_t operator()(const TagTarget &target) const
|
||||||
{
|
{
|
||||||
using std::hash;
|
using std::hash;
|
||||||
return ((hash<uint64>()(target.level()) ^ (hash<TagTarget::IdContainerType>()(target.tracks()) << 1)) >> 1)
|
return ((hash<std::uint64_t>()(target.level()) ^ (hash<TagTarget::IdContainerType>()(target.tracks()) << 1)) >> 1)
|
||||||
^ (hash<TagTarget::IdContainerType>()(target.attachments()) << 1);
|
^ (hash<TagTarget::IdContainerType>()(target.attachments()) << 1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -228,7 +228,7 @@ template <> struct hash<FieldScope> {
|
||||||
using std::hash;
|
using std::hash;
|
||||||
return (hash<FieldId>()(scope.field) ^ (hash<TagType>()(scope.tagType) << 1) >> 1)
|
return (hash<FieldId>()(scope.field) ^ (hash<TagType>()(scope.tagType) << 1) >> 1)
|
||||||
^ (hash<TagTarget>()(scope.tagTarget) ^ (static_cast<unsigned long>(scope.allTracks) << 4)
|
^ (hash<TagTarget>()(scope.tagTarget) ^ (static_cast<unsigned long>(scope.allTracks) << 4)
|
||||||
^ (hash<vector<uint64>>()(scope.trackIds) << 1) >> 1);
|
^ (hash<vector<std::uint64_t>>()(scope.trackIds) << 1) >> 1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ TagUsage parseUsageDenotation(const ApplicationUtilities::Argument &usageArg, Ta
|
||||||
TagTextEncoding parseEncodingDenotation(const ApplicationUtilities::Argument &encodingArg, TagTextEncoding defaultEncoding);
|
TagTextEncoding parseEncodingDenotation(const ApplicationUtilities::Argument &encodingArg, TagTextEncoding defaultEncoding);
|
||||||
ElementPosition parsePositionDenotation(
|
ElementPosition parsePositionDenotation(
|
||||||
const ApplicationUtilities::Argument &posArg, const ApplicationUtilities::Argument &valueArg, ElementPosition defaultPos);
|
const ApplicationUtilities::Argument &posArg, const ApplicationUtilities::Argument &valueArg, ElementPosition defaultPos);
|
||||||
uint64 parseUInt64(const ApplicationUtilities::Argument &arg, uint64 defaultValue);
|
std::uint64_t parseUInt64(const ApplicationUtilities::Argument &arg, std::uint64_t defaultValue);
|
||||||
TagTarget::IdContainerType parseIds(const std::string &concatenatedIds);
|
TagTarget::IdContainerType parseIds(const std::string &concatenatedIds);
|
||||||
bool applyTargetConfiguration(TagTarget &target, const std::string &configStr);
|
bool applyTargetConfiguration(TagTarget &target, const std::string &configStr);
|
||||||
FieldDenotations parseFieldDenotations(const ApplicationUtilities::Argument &fieldsArg, bool readOnly);
|
FieldDenotations parseFieldDenotations(const ApplicationUtilities::Argument &fieldsArg, bool readOnly);
|
||||||
|
|
|
@ -76,14 +76,14 @@ TagValue::TagValue(const TagParser::TagValue &tagValue, RAPIDJSON_NAMESPACE::Doc
|
||||||
if (tagValue.dataSize() > (1024 * 1024)) {
|
if (tagValue.dataSize() > (1024 * 1024)) {
|
||||||
throw ConversionUtilities::ConversionException("size is too big");
|
throw ConversionUtilities::ConversionException("size is too big");
|
||||||
}
|
}
|
||||||
ReflectiveRapidJSON::JsonReflector::push(ConversionUtilities::encodeBase64(reinterpret_cast<const byte *>(tagValue.dataPointer()), static_cast<uint32>(tagValue.dataSize())), value, allocator);
|
ReflectiveRapidJSON::JsonReflector::push(ConversionUtilities::encodeBase64(reinterpret_cast<const std::uint8_t *>(tagValue.dataPointer()), static_cast<std::uint32_t>(tagValue.dataSize())), value, allocator);
|
||||||
kind = "picture";
|
kind = "picture";
|
||||||
break;
|
break;
|
||||||
case TagDataType::Binary:
|
case TagDataType::Binary:
|
||||||
if (tagValue.dataSize() > (1024 * 1024)) {
|
if (tagValue.dataSize() > (1024 * 1024)) {
|
||||||
throw ConversionUtilities::ConversionException("size is too big");
|
throw ConversionUtilities::ConversionException("size is too big");
|
||||||
}
|
}
|
||||||
ReflectiveRapidJSON::JsonReflector::push(ConversionUtilities::encodeBase64(reinterpret_cast<const byte *>(tagValue.dataPointer()), static_cast<uint32>(tagValue.dataSize())), value, allocator);
|
ReflectiveRapidJSON::JsonReflector::push(ConversionUtilities::encodeBase64(reinterpret_cast<const std::uint8_t *>(tagValue.dataPointer()), static_cast<std::uint32_t>(tagValue.dataSize())), value, allocator);
|
||||||
kind = "binary";
|
kind = "binary";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -31,7 +31,7 @@ struct TargetInfo : ReflectiveRapidJSON::JsonSerializable<TargetInfo> {
|
||||||
using IdContainerType = TagParser::TagTarget::IdContainerType;
|
using IdContainerType = TagParser::TagTarget::IdContainerType;
|
||||||
TargetInfo(const TagParser::TagTarget &tagTarget, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator);
|
TargetInfo(const TagParser::TagTarget &tagTarget, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator);
|
||||||
|
|
||||||
uint64 level;
|
std::uint64_t level;
|
||||||
std::string levelName;
|
std::string levelName;
|
||||||
IdContainerType tracks;
|
IdContainerType tracks;
|
||||||
IdContainerType chapters;
|
IdContainerType chapters;
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#include <c++utilities/conversion/stringbuilder.h>
|
#include <c++utilities/conversion/stringbuilder.h>
|
||||||
#include <c++utilities/conversion/stringconversion.h>
|
#include <c++utilities/conversion/stringconversion.h>
|
||||||
#include <c++utilities/io/ansiescapecodes.h>
|
#include <c++utilities/io/ansiescapecodes.h>
|
||||||
#include <c++utilities/io/catchiofailure.h>
|
|
||||||
#include <c++utilities/io/nativefilestream.h>
|
#include <c++utilities/io/nativefilestream.h>
|
||||||
|
|
||||||
#if defined(TAGEDITOR_GUI_QTWIDGETS) || defined(TAGEDITOR_GUI_QTQUICK)
|
#if defined(TAGEDITOR_GUI_QTWIDGETS) || defined(TAGEDITOR_GUI_QTQUICK)
|
||||||
|
@ -127,8 +126,7 @@ void generateFileInfo(const ArgumentOccurrence &, const Argument &inputFileArg,
|
||||||
}
|
}
|
||||||
} catch (const TagParser::Failure &) {
|
} catch (const TagParser::Failure &) {
|
||||||
cerr << Phrases::Error << "A parsing failure occured when reading the file \"" << inputFileArg.values().front() << "\"." << Phrases::EndFlush;
|
cerr << Phrases::Error << "A parsing failure occured when reading the file \"" << inputFileArg.values().front() << "\"." << Phrases::EndFlush;
|
||||||
} catch (...) {
|
} catch (const std::ios_base::failure &) {
|
||||||
::IoUtilities::catchIoFailure();
|
|
||||||
cerr << Phrases::Error << "An IO failure occured when reading the file \"" << inputFileArg.values().front() << "\"." << Phrases::EndFlush;
|
cerr << Phrases::Error << "An IO failure occured when reading the file \"" << inputFileArg.values().front() << "\"." << Phrases::EndFlush;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -283,7 +281,7 @@ void displayFileInfo(const ArgumentOccurrence &, const Argument &filesArg, const
|
||||||
printProperty("MIME-type", attachment->mimeType());
|
printProperty("MIME-type", attachment->mimeType());
|
||||||
printProperty("Description", attachment->description());
|
printProperty("Description", attachment->description());
|
||||||
if (attachment->data()) {
|
if (attachment->data()) {
|
||||||
printProperty("Size", dataSizeToString(static_cast<uint64>(attachment->data()->size()), true));
|
printProperty("Size", dataSizeToString(static_cast<std::uint64_t>(attachment->data()->size()), true));
|
||||||
}
|
}
|
||||||
cout << '\n';
|
cout << '\n';
|
||||||
}
|
}
|
||||||
|
@ -310,9 +308,8 @@ void displayFileInfo(const ArgumentOccurrence &, const Argument &filesArg, const
|
||||||
|
|
||||||
} catch (const TagParser::Failure &) {
|
} catch (const TagParser::Failure &) {
|
||||||
cerr << Phrases::Error << "A parsing failure occured when reading the file \"" << file << "\"." << Phrases::EndFlush;
|
cerr << Phrases::Error << "A parsing failure occured when reading the file \"" << file << "\"." << Phrases::EndFlush;
|
||||||
} catch (...) {
|
} catch (const std::ios_base::failure &) {
|
||||||
::IoUtilities::catchIoFailure();
|
cerr << Phrases::Error << "An IO failure occured when reading the file \"" << file << "\"" << Phrases::EndFlush;
|
||||||
cerr << Phrases::Error << "An IO failure occured when reading the file \"" << file << "\"." << Phrases::EndFlush;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printDiagMessages(diag, "Diagnostic messages:", verboseArg.isPresent());
|
printDiagMessages(diag, "Diagnostic messages:", verboseArg.isPresent());
|
||||||
|
@ -373,8 +370,7 @@ void displayTagInfo(const Argument &fieldsArg, const Argument &showUnsupportedAr
|
||||||
}
|
}
|
||||||
} catch (const TagParser::Failure &) {
|
} catch (const TagParser::Failure &) {
|
||||||
cerr << Phrases::Error << "A parsing failure occured when reading the file \"" << file << "\"." << Phrases::EndFlush;
|
cerr << Phrases::Error << "A parsing failure occured when reading the file \"" << file << "\"." << Phrases::EndFlush;
|
||||||
} catch (...) {
|
} catch (const std::ios_base::failure &) {
|
||||||
::IoUtilities::catchIoFailure();
|
|
||||||
cerr << Phrases::Error << "An IO failure occured when reading the file \"" << file << "\"." << Phrases::EndFlush;
|
cerr << Phrases::Error << "An IO failure occured when reading the file \"" << file << "\"." << Phrases::EndFlush;
|
||||||
}
|
}
|
||||||
printDiagMessages(diag, "Diagnostic messages:", verboseArg.isPresent());
|
printDiagMessages(diag, "Diagnostic messages:", verboseArg.isPresent());
|
||||||
|
@ -453,7 +449,7 @@ void setTagInfo(const SetTagInfoArgs &args)
|
||||||
// parse ID3v2 version
|
// parse ID3v2 version
|
||||||
if (args.id3v2VersionArg.isPresent()) {
|
if (args.id3v2VersionArg.isPresent()) {
|
||||||
try {
|
try {
|
||||||
settings.id3v2MajorVersion = stringToNumber<byte>(args.id3v2VersionArg.values().front());
|
settings.id3v2MajorVersion = stringToNumber<std::uint8_t>(args.id3v2VersionArg.values().front());
|
||||||
if (settings.id3v2MajorVersion < 1 || settings.id3v2MajorVersion > 4) {
|
if (settings.id3v2MajorVersion < 1 || settings.id3v2MajorVersion > 4) {
|
||||||
throw ConversionException();
|
throw ConversionException();
|
||||||
}
|
}
|
||||||
|
@ -632,8 +628,7 @@ void setTagInfo(const SetTagInfoArgs &args)
|
||||||
convertedValues.emplace_back(move(value));
|
convertedValues.emplace_back(move(value));
|
||||||
} catch (const TagParser::Failure &) {
|
} catch (const TagParser::Failure &) {
|
||||||
diag.emplace_back(DiagLevel::Critical, "Unable to parse specified cover file.", context);
|
diag.emplace_back(DiagLevel::Critical, "Unable to parse specified cover file.", context);
|
||||||
} catch (...) {
|
} catch (const std::ios_base::failure &) {
|
||||||
::IoUtilities::catchIoFailure();
|
|
||||||
diag.emplace_back(DiagLevel::Critical, "An IO error occured when parsing the specified cover file.", context);
|
diag.emplace_back(DiagLevel::Critical, "An IO error occured when parsing the specified cover file.", context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -672,7 +667,7 @@ void setTagInfo(const SetTagInfoArgs &args)
|
||||||
} else if (field.denotes("language")) {
|
} else if (field.denotes("language")) {
|
||||||
track->setLanguage(value);
|
track->setLanguage(value);
|
||||||
} else if (field.denotes("tracknumber")) {
|
} else if (field.denotes("tracknumber")) {
|
||||||
track->setTrackNumber(stringToNumber<uint32>(value));
|
track->setTrackNumber(stringToNumber<std::uint32_t>(value));
|
||||||
} else if (field.denotes("enabled")) {
|
} else if (field.denotes("enabled")) {
|
||||||
track->setEnabled(stringToBool(value));
|
track->setEnabled(stringToBool(value));
|
||||||
} else if (field.denotes("forced")) {
|
} else if (field.denotes("forced")) {
|
||||||
|
@ -768,8 +763,7 @@ void setTagInfo(const SetTagInfoArgs &args)
|
||||||
} catch (const TagParser::Failure &) {
|
} catch (const TagParser::Failure &) {
|
||||||
finalizeLog();
|
finalizeLog();
|
||||||
cerr << " - " << Phrases::Error << "A parsing failure occured when reading/writing the file \"" << file << "\"." << Phrases::EndFlush;
|
cerr << " - " << Phrases::Error << "A parsing failure occured when reading/writing the file \"" << file << "\"." << Phrases::EndFlush;
|
||||||
} catch (...) {
|
} catch (const std::ios_base::failure &) {
|
||||||
::IoUtilities::catchIoFailure();
|
|
||||||
finalizeLog();
|
finalizeLog();
|
||||||
cerr << " - " << Phrases::Error << "An IO failure occured when reading/writing the file \"" << file << "\"." << Phrases::EndFlush;
|
cerr << " - " << Phrases::Error << "An IO failure occured when reading/writing the file \"" << file << "\"." << Phrases::EndFlush;
|
||||||
}
|
}
|
||||||
|
@ -860,8 +854,7 @@ void extractField(
|
||||||
outputFileStream.write(value.first->dataPointer(), value.first->dataSize());
|
outputFileStream.write(value.first->dataPointer(), value.first->dataSize());
|
||||||
outputFileStream.flush();
|
outputFileStream.flush();
|
||||||
cout << " - Value has been saved to \"" << path << "\"." << endl;
|
cout << " - Value has been saved to \"" << path << "\"." << endl;
|
||||||
} catch (...) {
|
} catch (const std::ios_base::failure &) {
|
||||||
::IoUtilities::catchIoFailure();
|
|
||||||
cerr << " - " << Phrases::Error << "An IO error occured when writing the file \"" << path << "\"." << Phrases::End;
|
cerr << " - " << Phrases::Error << "An IO error occured when writing the file \"" << path << "\"." << Phrases::End;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -911,8 +904,7 @@ void extractField(
|
||||||
attachment.first->data()->copyTo(outputFileStream);
|
attachment.first->data()->copyTo(outputFileStream);
|
||||||
outputFileStream.flush();
|
outputFileStream.flush();
|
||||||
cout << " - Value has been saved to \"" << path << "\"." << endl;
|
cout << " - Value has been saved to \"" << path << "\"." << endl;
|
||||||
} catch (...) {
|
} catch (const std::ios_base::failure &) {
|
||||||
::IoUtilities::catchIoFailure();
|
|
||||||
cerr << " - " << Phrases::Error << "An IO error occured when writing the file \"" << path << "\"." << Phrases::EndFlush;
|
cerr << " - " << Phrases::Error << "An IO error occured when writing the file \"" << path << "\"." << Phrases::EndFlush;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -925,8 +917,7 @@ void extractField(
|
||||||
|
|
||||||
} catch (const TagParser::Failure &) {
|
} catch (const TagParser::Failure &) {
|
||||||
cerr << Phrases::Error << "A parsing failure occured when reading the file \"" << file << "\"." << Phrases::End;
|
cerr << Phrases::Error << "A parsing failure occured when reading the file \"" << file << "\"." << Phrases::End;
|
||||||
} catch (...) {
|
} catch (const std::ios_base::failure &) {
|
||||||
::IoUtilities::catchIoFailure();
|
|
||||||
cerr << Phrases::Error << "An IO failure occured when reading the file \"" << file << "\"." << Phrases::End;
|
cerr << Phrases::Error << "An IO failure occured when reading the file \"" << file << "\"." << Phrases::End;
|
||||||
}
|
}
|
||||||
printDiagMessages(diag, "Diagnostic messages:", verboseArg.isPresent());
|
printDiagMessages(diag, "Diagnostic messages:", verboseArg.isPresent());
|
||||||
|
@ -961,8 +952,7 @@ void exportToJson(const ArgumentOccurrence &, const Argument &filesArg, const Ar
|
||||||
jsonData.emplace_back(fileInfo, document.GetAllocator());
|
jsonData.emplace_back(fileInfo, document.GetAllocator());
|
||||||
} catch (const TagParser::Failure &) {
|
} catch (const TagParser::Failure &) {
|
||||||
cerr << Phrases::Error << "A parsing failure occured when reading the file \"" << file << "\"." << Phrases::EndFlush;
|
cerr << Phrases::Error << "A parsing failure occured when reading the file \"" << file << "\"." << Phrases::EndFlush;
|
||||||
} catch (...) {
|
} catch (const std::ios_base::failure &) {
|
||||||
::IoUtilities::catchIoFailure();
|
|
||||||
cerr << Phrases::Error << "An IO failure occured when reading the file \"" << file << "\"." << Phrases::EndFlush;
|
cerr << Phrases::Error << "An IO failure occured when reading the file \"" << file << "\"." << Phrases::EndFlush;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
#define DBQUERY_H
|
#define DBQUERY_H
|
||||||
|
|
||||||
#include <c++utilities/application/global.h>
|
#include <c++utilities/application/global.h>
|
||||||
#include <c++utilities/conversion/types.h>
|
|
||||||
|
|
||||||
#include <QAbstractTableModel>
|
#include <QAbstractTableModel>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
|
@ -30,9 +29,9 @@ struct SongDescription {
|
||||||
QString artist;
|
QString artist;
|
||||||
QString year;
|
QString year;
|
||||||
QString genre;
|
QString genre;
|
||||||
int32 track;
|
std::int32_t track;
|
||||||
int32 totalTracks;
|
std::int32_t totalTracks;
|
||||||
int32 disk;
|
std::int32_t disk;
|
||||||
QByteArray cover;
|
QByteArray cover;
|
||||||
QString lyrics;
|
QString lyrics;
|
||||||
QString coverUrl;
|
QString coverUrl;
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
|
|
||||||
#include <qtutilities/misc/conversion.h>
|
#include <qtutilities/misc/conversion.h>
|
||||||
|
|
||||||
#include <c++utilities/io/catchiofailure.h>
|
|
||||||
#include <c++utilities/io/copy.h>
|
#include <c++utilities/io/copy.h>
|
||||||
#include <c++utilities/io/nativefilestream.h>
|
#include <c++utilities/io/nativefilestream.h>
|
||||||
|
|
||||||
|
@ -115,9 +114,9 @@ void AttachmentsEdit::showFileSelection()
|
||||||
} catch (const Failure &) {
|
} catch (const Failure &) {
|
||||||
QMessageBox::warning(this, QApplication::applicationName(),
|
QMessageBox::warning(this, QApplication::applicationName(),
|
||||||
tr("The file couldn't be added because the attachments of the file could not be parsed successfully."));
|
tr("The file couldn't be added because the attachments of the file could not be parsed successfully."));
|
||||||
} catch (...) {
|
} catch (const std::ios_base::failure &failure) {
|
||||||
::IoUtilities::catchIoFailure();
|
QMessageBox::warning(this, QApplication::applicationName(),
|
||||||
QMessageBox::warning(this, QApplication::applicationName(), tr("The file couldn't be added because an IO error occured."));
|
tr("The file couldn't be added because an IO error occured: ") + QString::fromLocal8Bit(failure.what()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,9 +138,9 @@ void AttachmentsEdit::extractSelected()
|
||||||
file.open(toNativeFileName(fileName).data(), ios_base::out | ios_base::binary);
|
file.open(toNativeFileName(fileName).data(), ios_base::out | ios_base::binary);
|
||||||
CopyHelper<0x1000> helper;
|
CopyHelper<0x1000> helper;
|
||||||
helper.copy(input, file, data->size());
|
helper.copy(input, file, data->size());
|
||||||
} catch (...) {
|
} catch (const std::ios_base::failure &failure) {
|
||||||
::IoUtilities::catchIoFailure();
|
QMessageBox::warning(this, QApplication::applicationName(),
|
||||||
QMessageBox::warning(this, QApplication::applicationName(), tr("An IO error occured when extracting the attached file."));
|
tr("An IO error occured when extracting the attached file: ") + QString::fromLocal8Bit(failure.what()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -21,7 +21,7 @@ using namespace TagParser;
|
||||||
|
|
||||||
namespace QtGui {
|
namespace QtGui {
|
||||||
|
|
||||||
void addIds(vector<uint64> &target, ChecklistModel *sourceModel)
|
void addIds(vector<std::uint64_t> &target, ChecklistModel *sourceModel)
|
||||||
{
|
{
|
||||||
for (const auto &item : sourceModel->items()) {
|
for (const auto &item : sourceModel->items()) {
|
||||||
if (item.isChecked()) {
|
if (item.isChecked()) {
|
||||||
|
@ -30,9 +30,9 @@ void addIds(vector<uint64> &target, ChecklistModel *sourceModel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T> void addIds(ChecklistModel *targetModel, const T &fileIds, const vector<uint64> &targetIds)
|
template <class T> void addIds(ChecklistModel *targetModel, const T &fileIds, const vector<std::uint64_t> &targetIds)
|
||||||
{
|
{
|
||||||
QList<uint64> ids;
|
QList<std::uint64_t> ids;
|
||||||
QList<ChecklistItem> items;
|
QList<ChecklistItem> items;
|
||||||
for (const auto &i : fileIds) {
|
for (const auto &i : fileIds) {
|
||||||
items << ChecklistItem(QVariant::fromValue(i->id()), QString::fromUtf8(i->label().data()),
|
items << ChecklistItem(QVariant::fromValue(i->id()), QString::fromUtf8(i->label().data()),
|
||||||
|
@ -47,7 +47,7 @@ template <class T> void addIds(ChecklistModel *targetModel, const T &fileIds, co
|
||||||
targetModel->setItems(items);
|
targetModel->setItems(items);
|
||||||
}
|
}
|
||||||
|
|
||||||
void addIds(ChecklistModel *targetModel, const vector<uint64> &targetIds)
|
void addIds(ChecklistModel *targetModel, const vector<std::uint64_t> &targetIds)
|
||||||
{
|
{
|
||||||
QList<ChecklistItem> items;
|
QList<ChecklistItem> items;
|
||||||
for (auto id : targetIds) {
|
for (auto id : targetIds) {
|
||||||
|
@ -89,14 +89,14 @@ EnterTargetDialog::~EnterTargetDialog()
|
||||||
|
|
||||||
void EnterTargetDialog::updateLevelNamePlaceholderText(int i)
|
void EnterTargetDialog::updateLevelNamePlaceholderText(int i)
|
||||||
{
|
{
|
||||||
const char *levelName = i >= 0 ? tagTargetLevelName(containerTargetLevel(m_currentContainerFormat, static_cast<uint32>(i))) : nullptr;
|
const char *levelName = i >= 0 ? tagTargetLevelName(containerTargetLevel(m_currentContainerFormat, static_cast<std::uint32_t>(i))) : nullptr;
|
||||||
m_ui->levelNameLineEdit->setPlaceholderText(levelName ? QString::fromUtf8(levelName) : QString());
|
m_ui->levelNameLineEdit->setPlaceholderText(levelName ? QString::fromUtf8(levelName) : QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
TagParser::TagTarget EnterTargetDialog::target() const
|
TagParser::TagTarget EnterTargetDialog::target() const
|
||||||
{
|
{
|
||||||
TagTarget target;
|
TagTarget target;
|
||||||
target.setLevel(static_cast<uint64>(m_ui->levelSpinBox->value()));
|
target.setLevel(static_cast<std::uint64_t>(m_ui->levelSpinBox->value()));
|
||||||
target.setLevelName(m_ui->levelNameLineEdit->text().toUtf8().data());
|
target.setLevelName(m_ui->levelNameLineEdit->text().toUtf8().data());
|
||||||
addIds(target.tracks(), m_tracksModel);
|
addIds(target.tracks(), m_tracksModel);
|
||||||
addIds(target.chapters(), m_chaptersModel);
|
addIds(target.chapters(), m_chaptersModel);
|
||||||
|
|
|
@ -512,7 +512,7 @@ void FileInfoModel::updateCache()
|
||||||
}
|
}
|
||||||
if (!chapter->tracks().empty()) {
|
if (!chapter->tracks().empty()) {
|
||||||
QStringList trackIds;
|
QStringList trackIds;
|
||||||
for (const uint64 id : chapter->tracks()) {
|
for (const auto id : chapter->tracks()) {
|
||||||
trackIds << QString::number(id);
|
trackIds << QString::number(id);
|
||||||
}
|
}
|
||||||
chapterHelper.appendRow(tr("Tracks"), trackIds.join(QStringLiteral(", ")));
|
chapterHelper.appendRow(tr("Tracks"), trackIds.join(QStringLiteral(", ")));
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#include <qtutilities/misc/conversion.h>
|
#include <qtutilities/misc/conversion.h>
|
||||||
|
|
||||||
#include <c++utilities/conversion/stringconversion.h>
|
#include <c++utilities/conversion/stringconversion.h>
|
||||||
#include <c++utilities/io/catchiofailure.h>
|
|
||||||
#include <c++utilities/misc/traits.h>
|
#include <c++utilities/misc/traits.h>
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
@ -374,8 +373,7 @@ void PicturePreviewSelection::addOfSelectedType(const QString &path)
|
||||||
|
|
||||||
} catch (const TagParser::Failure &) {
|
} catch (const TagParser::Failure &) {
|
||||||
QMessageBox::critical(this, QCoreApplication::applicationName(), tr("Unable to parse specified cover file."));
|
QMessageBox::critical(this, QCoreApplication::applicationName(), tr("Unable to parse specified cover file."));
|
||||||
} catch (...) {
|
} catch (const std::ios_base::failure &) {
|
||||||
::IoUtilities::catchIoFailure();
|
|
||||||
QMessageBox::critical(this, QCoreApplication::applicationName(), tr("An IO error occured when parsing the specified cover file."));
|
QMessageBox::critical(this, QCoreApplication::applicationName(), tr("An IO error occured when parsing the specified cover file."));
|
||||||
}
|
}
|
||||||
updatePreview(m_currentTypeIndex);
|
updatePreview(m_currentTypeIndex);
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
|
|
||||||
#include <c++utilities/conversion/stringconversion.h>
|
#include <c++utilities/conversion/stringconversion.h>
|
||||||
#include <c++utilities/io/ansiescapecodes.h>
|
#include <c++utilities/io/ansiescapecodes.h>
|
||||||
#include <c++utilities/io/catchiofailure.h>
|
|
||||||
#include <c++utilities/io/path.h>
|
#include <c++utilities/io/path.h>
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
@ -817,8 +816,7 @@ bool TagEditorWidget::startParsing(const QString &path, bool forceRefresh)
|
||||||
// try to open with write access
|
// try to open with write access
|
||||||
try {
|
try {
|
||||||
m_fileInfo.reopen(false);
|
m_fileInfo.reopen(false);
|
||||||
} catch (...) {
|
} catch (const std::ios_base::failure &) {
|
||||||
::IoUtilities::catchIoFailure();
|
|
||||||
// try to open read-only if opening with write access failed
|
// try to open read-only if opening with write access failed
|
||||||
m_fileInfo.reopen(true);
|
m_fileInfo.reopen(true);
|
||||||
}
|
}
|
||||||
|
@ -828,8 +826,7 @@ bool TagEditorWidget::startParsing(const QString &path, bool forceRefresh)
|
||||||
} catch (const Failure &) {
|
} catch (const Failure &) {
|
||||||
// the file has been opened; parsing notifications will be shown in the info box
|
// the file has been opened; parsing notifications will be shown in the info box
|
||||||
result = FatalParsingError;
|
result = FatalParsingError;
|
||||||
} catch (...) {
|
} catch (const std::ios_base::failure &) {
|
||||||
::IoUtilities::catchIoFailure();
|
|
||||||
// the file could not be opened because an IO error occured
|
// the file could not be opened because an IO error occured
|
||||||
m_fileInfo.close(); // ensure file is closed
|
m_fileInfo.close(); // ensure file is closed
|
||||||
result = IoError;
|
result = IoError;
|
||||||
|
@ -1155,8 +1152,7 @@ bool TagEditorWidget::startSaving()
|
||||||
m_fileInfo.applyChanges(m_diag, progress);
|
m_fileInfo.applyChanges(m_diag, progress);
|
||||||
} catch (const Failure &) {
|
} catch (const Failure &) {
|
||||||
processingError = true;
|
processingError = true;
|
||||||
} catch (...) {
|
} catch (const std::ios_base::failure &) {
|
||||||
::IoUtilities::catchIoFailure();
|
|
||||||
ioError = true;
|
ioError = true;
|
||||||
}
|
}
|
||||||
} catch (const exception &e) {
|
} catch (const exception &e) {
|
||||||
|
|
|
@ -276,11 +276,11 @@ template <> void mkElementContent(QXmlStreamWriter &writer, EbmlElement *element
|
||||||
{
|
{
|
||||||
switch (element->id()) {
|
switch (element->id()) {
|
||||||
case MatroskaIds::SeekID: {
|
case MatroskaIds::SeekID: {
|
||||||
const uint64 seekId = element->readUInteger();
|
const std::uint64_t seekId = element->readUInteger();
|
||||||
writer.writeCharacters(QStringLiteral(", denoted type: 0x"));
|
writer.writeCharacters(QStringLiteral(", denoted type: 0x"));
|
||||||
writer.writeCharacters(QString::number(seekId, 16));
|
writer.writeCharacters(QString::number(seekId, 16));
|
||||||
if (seekId <= numeric_limits<uint32>::max()) {
|
if (seekId <= numeric_limits<std::uint32_t>::max()) {
|
||||||
const char *const seekIdName = matroskaIdName(static_cast<uint32>(seekId));
|
const char *const seekIdName = matroskaIdName(static_cast<std::uint32_t>(seekId));
|
||||||
if (*seekIdName) {
|
if (*seekIdName) {
|
||||||
writer.writeCharacters(QStringLiteral(" \""));
|
writer.writeCharacters(QStringLiteral(" \""));
|
||||||
writer.writeCharacters(QString::fromLatin1(seekIdName));
|
writer.writeCharacters(QString::fromLatin1(seekIdName));
|
||||||
|
@ -291,7 +291,7 @@ template <> void mkElementContent(QXmlStreamWriter &writer, EbmlElement *element
|
||||||
}
|
}
|
||||||
case MatroskaIds::SeekPosition: {
|
case MatroskaIds::SeekPosition: {
|
||||||
writer.writeCharacters(QStringLiteral(", denoted position: "));
|
writer.writeCharacters(QStringLiteral(", denoted position: "));
|
||||||
const uint64 seekPos = element->readUInteger();
|
const std::uint64_t seekPos = element->readUInteger();
|
||||||
const auto seekPosStr = QString::number(seekPos);
|
const auto seekPosStr = QString::number(seekPos);
|
||||||
writer.writeStartElement(QStringLiteral("span"));
|
writer.writeStartElement(QStringLiteral("span"));
|
||||||
writer.writeAttribute(QStringLiteral("data-role"), QStringLiteral("offset"));
|
writer.writeAttribute(QStringLiteral("data-role"), QStringLiteral("offset"));
|
||||||
|
@ -684,8 +684,8 @@ public:
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Name"), qstr(attachment->name()));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Name"), qstr(attachment->name()));
|
||||||
}
|
}
|
||||||
if (attachment->data()) {
|
if (attachment->data()) {
|
||||||
rowMaker.mkRow(
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Size"),
|
||||||
QCoreApplication::translate("HtmlInfo", "Size"), qstr(dataSizeToString(static_cast<uint64>(attachment->data()->size()), true)));
|
qstr(dataSizeToString(static_cast<std::uint64_t>(attachment->data()->size()), true)));
|
||||||
}
|
}
|
||||||
if (!attachment->mimeType().empty()) {
|
if (!attachment->mimeType().empty()) {
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Mime-type"), qstr(attachment->mimeType()));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Mime-type"), qstr(attachment->mimeType()));
|
||||||
|
@ -728,7 +728,7 @@ public:
|
||||||
}
|
}
|
||||||
if (!chapter.tracks().empty()) {
|
if (!chapter.tracks().empty()) {
|
||||||
QStringList trackIds;
|
QStringList trackIds;
|
||||||
for (uint64 id : chapter.tracks()) {
|
for (std::uint64_t id : chapter.tracks()) {
|
||||||
trackIds << QString::number(id);
|
trackIds << QString::number(id);
|
||||||
}
|
}
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Tracks"), trackIds.join(QStringLiteral(", ")));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Tracks"), trackIds.join(QStringLiteral(", ")));
|
||||||
|
@ -912,8 +912,7 @@ public:
|
||||||
const TimeSpan duration = m_file.duration();
|
const TimeSpan duration = m_file.duration();
|
||||||
if (!duration.isNull()) {
|
if (!duration.isNull()) {
|
||||||
m_rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Duration"), qstr(duration.toString(TimeSpanOutputFormat::WithMeasures)));
|
m_rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Duration"), qstr(duration.toString(TimeSpanOutputFormat::WithMeasures)));
|
||||||
m_rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Overall avg. bitrate"),
|
m_rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Overall avg. bitrate"), qstr(bitrateToString(m_file.overallAverageBitrate())));
|
||||||
qstr(bitrateToString(m_file.overallAverageBitrate())));
|
|
||||||
}
|
}
|
||||||
const char *const mimeType = m_file.mimeType();
|
const char *const mimeType = m_file.mimeType();
|
||||||
if (*mimeType) {
|
if (*mimeType) {
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#include <qtutilities/misc/conversion.h>
|
#include <qtutilities/misc/conversion.h>
|
||||||
|
|
||||||
#include <c++utilities/conversion/conversionexception.h>
|
#include <c++utilities/conversion/conversionexception.h>
|
||||||
#include <c++utilities/io/catchiofailure.h>
|
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
|
@ -163,8 +162,7 @@ TAGEDITOR_JS_VALUE TagEditorObject::parseFileInfo(const QString &fileName)
|
||||||
} catch (const Failure &) {
|
} catch (const Failure &) {
|
||||||
// parsing notifications will be addded anyways
|
// parsing notifications will be addded anyways
|
||||||
criticalParseingErrorOccured = true;
|
criticalParseingErrorOccured = true;
|
||||||
} catch (...) {
|
} catch (const std::ios_base::failure &) {
|
||||||
::IoUtilities::catchIoFailure();
|
|
||||||
criticalParseingErrorOccured = true;
|
criticalParseingErrorOccured = true;
|
||||||
ioErrorOccured = true;
|
ioErrorOccured = true;
|
||||||
}
|
}
|
||||||
|
@ -189,7 +187,7 @@ TAGEDITOR_JS_VALUE TagEditorObject::parseFileInfo(const QString &fileName)
|
||||||
auto combinedTagObject = m_engine->newObject();
|
auto combinedTagObject = m_engine->newObject();
|
||||||
auto combinedTagNotifications = m_engine->newArray();
|
auto combinedTagNotifications = m_engine->newArray();
|
||||||
auto tagsObject = m_engine->newArray(static_cast<uint>(tags.size()));
|
auto tagsObject = m_engine->newArray(static_cast<uint>(tags.size()));
|
||||||
uint32 tagIndex = 0;
|
std::uint32_t tagIndex = 0;
|
||||||
for (auto tagIterator = tags.cbegin(), end = tags.cend(); tagIterator != end; ++tagIterator, ++tagIndex) {
|
for (auto tagIterator = tags.cbegin(), end = tags.cend(); tagIterator != end; ++tagIterator, ++tagIndex) {
|
||||||
const Tag &tag = **tagIterator;
|
const Tag &tag = **tagIterator;
|
||||||
auto tagObject = m_engine->newObject();
|
auto tagObject = m_engine->newObject();
|
||||||
|
@ -205,7 +203,7 @@ TAGEDITOR_JS_VALUE TagEditorObject::parseFileInfo(const QString &fileName)
|
||||||
// gather track information
|
// gather track information
|
||||||
const vector<AbstractTrack *> tracks = fileInfo.tracks();
|
const vector<AbstractTrack *> tracks = fileInfo.tracks();
|
||||||
auto tracksObject = m_engine->newArray(static_cast<uint>(tracks.size()));
|
auto tracksObject = m_engine->newArray(static_cast<uint>(tracks.size()));
|
||||||
uint32 trackIndex = 0;
|
std::uint32_t trackIndex = 0;
|
||||||
for (auto trackIterator = tracks.cbegin(), end = tracks.cend(); trackIterator != end; ++trackIterator, ++trackIndex) {
|
for (auto trackIterator = tracks.cbegin(), end = tracks.cend(); trackIterator != end; ++trackIterator, ++trackIndex) {
|
||||||
const AbstractTrack &track = **trackIterator;
|
const AbstractTrack &track = **trackIterator;
|
||||||
auto trackObject = m_engine->newObject();
|
auto trackObject = m_engine->newObject();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
#include <c++utilities/conversion/stringbuilder.h>
|
||||||
#include <c++utilities/conversion/stringconversion.h>
|
#include <c++utilities/conversion/stringconversion.h>
|
||||||
#include <c++utilities/io/catchiofailure.h>
|
|
||||||
#include <c++utilities/io/misc.h>
|
#include <c++utilities/io/misc.h>
|
||||||
#include <c++utilities/io/path.h>
|
#include <c++utilities/io/path.h>
|
||||||
|
|
||||||
|
@ -697,7 +697,7 @@ void CliTests::testHandlingAttachments()
|
||||||
origFile.exceptions(ios_base::failbit | ios_base::badbit), extFile.exceptions(ios_base::failbit | ios_base::badbit);
|
origFile.exceptions(ios_base::failbit | ios_base::badbit), extFile.exceptions(ios_base::failbit | ios_base::badbit);
|
||||||
origFile.open(mkvFile2.data() + 5, ios_base::in | ios_base::binary), extFile.open("/tmp/extracted.mkv", ios_base::in | ios_base::binary);
|
origFile.open(mkvFile2.data() + 5, ios_base::in | ios_base::binary), extFile.open("/tmp/extracted.mkv", ios_base::in | ios_base::binary);
|
||||||
origFile.seekg(0, ios_base::end), extFile.seekg(0, ios_base::end);
|
origFile.seekg(0, ios_base::end), extFile.seekg(0, ios_base::end);
|
||||||
int64 origFileSize = origFile.tellg(), extFileSize = extFile.tellg();
|
std::int64_t origFileSize = origFile.tellg(), extFileSize = extFile.tellg();
|
||||||
CPPUNIT_ASSERT_EQUAL(origFileSize, extFileSize);
|
CPPUNIT_ASSERT_EQUAL(origFileSize, extFileSize);
|
||||||
for (origFile.seekg(0), extFile.seekg(0); origFileSize > 0; --origFileSize) {
|
for (origFile.seekg(0), extFile.seekg(0); origFileSize > 0; --origFileSize) {
|
||||||
CPPUNIT_ASSERT_EQUAL(origFile.get(), extFile.get());
|
CPPUNIT_ASSERT_EQUAL(origFile.get(), extFile.get());
|
||||||
|
@ -900,7 +900,7 @@ void CliTests::testExtraction()
|
||||||
MediaFileInfo extractedInfo("/tmp/extracted.jpeg");
|
MediaFileInfo extractedInfo("/tmp/extracted.jpeg");
|
||||||
extractedInfo.open(true);
|
extractedInfo.open(true);
|
||||||
extractedInfo.parseContainerFormat(diag);
|
extractedInfo.parseContainerFormat(diag);
|
||||||
CPPUNIT_ASSERT_EQUAL(static_cast<uint64>(22771), extractedInfo.size());
|
CPPUNIT_ASSERT_EQUAL(static_cast<std::uint64_t>(22771), extractedInfo.size());
|
||||||
CPPUNIT_ASSERT(ContainerFormat::Jpeg == extractedInfo.containerFormat());
|
CPPUNIT_ASSERT(ContainerFormat::Jpeg == extractedInfo.containerFormat());
|
||||||
extractedInfo.invalidate();
|
extractedInfo.invalidate();
|
||||||
|
|
||||||
|
@ -913,7 +913,7 @@ void CliTests::testExtraction()
|
||||||
TESTUTILS_ASSERT_EXEC(args3);
|
TESTUTILS_ASSERT_EXEC(args3);
|
||||||
extractedInfo.open(true);
|
extractedInfo.open(true);
|
||||||
extractedInfo.parseContainerFormat(diag);
|
extractedInfo.parseContainerFormat(diag);
|
||||||
CPPUNIT_ASSERT_EQUAL(static_cast<uint64>(22771), extractedInfo.size());
|
CPPUNIT_ASSERT_EQUAL(static_cast<std::uint64_t>(22771), extractedInfo.size());
|
||||||
CPPUNIT_ASSERT(ContainerFormat::Jpeg == extractedInfo.containerFormat());
|
CPPUNIT_ASSERT(ContainerFormat::Jpeg == extractedInfo.containerFormat());
|
||||||
CPPUNIT_ASSERT_EQUAL(0, remove("/tmp/extracted.jpeg"));
|
CPPUNIT_ASSERT_EQUAL(0, remove("/tmp/extracted.jpeg"));
|
||||||
CPPUNIT_ASSERT_EQUAL(0, remove(mp4File2.data()));
|
CPPUNIT_ASSERT_EQUAL(0, remove(mp4File2.data()));
|
||||||
|
|
Loading…
Reference in New Issue