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