Move tagparser to namespace TagParser
This commit is contained in:
parent
c2b2e4ac44
commit
c1a3e53dc9
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <tagparser/tag.h>
|
||||
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
|
||||
#if defined(TAGEDITOR_GUI_QTWIDGETS) || defined(TAGEDITOR_GUI_QTQUICK)
|
||||
using namespace Models;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# define Q_OBJECT
|
||||
#endif
|
||||
|
||||
namespace Media {
|
||||
namespace TagParser {
|
||||
DECLARE_ENUM_CLASS(KnownField, unsigned int);
|
||||
}
|
||||
|
||||
|
@ -29,11 +29,11 @@ public:
|
|||
CommonFields
|
||||
};
|
||||
|
||||
static const char *fieldName(Media::KnownField field);
|
||||
static const char *fieldName(TagParser::KnownField field);
|
||||
|
||||
#if defined(TAGEDITOR_GUI_QTWIDGETS) || defined(TAGEDITOR_GUI_QTQUICK)
|
||||
static QString translatedFieldName(Media::KnownField field);
|
||||
static Models::ChecklistItem mkItem(Media::KnownField field, Qt::CheckState checkState = Qt::Checked);
|
||||
static QString translatedFieldName(TagParser::KnownField field);
|
||||
static Models::ChecklistItem mkItem(TagParser::KnownField field, Qt::CheckState checkState = Qt::Checked);
|
||||
|
||||
explicit KnownFieldModel(QObject *parent = nullptr, DefaultSelection defaultSelection = DefaultSelection::None);
|
||||
explicit KnownFieldModel(const QList<Models::ChecklistItem> &items, QObject *parent = nullptr);
|
||||
|
@ -44,7 +44,7 @@ public:
|
|||
};
|
||||
|
||||
#if defined(TAGEDITOR_GUI_QTWIDGETS) || defined(TAGEDITOR_GUI_QTQUICK)
|
||||
inline Models::ChecklistItem KnownFieldModel::mkItem(Media::KnownField field, Qt::CheckState checkState)
|
||||
inline Models::ChecklistItem KnownFieldModel::mkItem(TagParser::KnownField field, Qt::CheckState checkState)
|
||||
{
|
||||
return Models::ChecklistItem(static_cast<int>(field), translatedFieldName(field), checkState);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <QSettings>
|
||||
#include <QFile>
|
||||
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
|
||||
namespace Settings {
|
||||
|
||||
|
@ -104,16 +104,16 @@ void restore()
|
|||
settings.beginGroup(QStringLiteral("tagprocessing"));
|
||||
switch(settings.value(QStringLiteral("preferredencoding"), 1).toInt()) {
|
||||
case 0:
|
||||
v.tagPocessing.preferredEncoding = Media::TagTextEncoding::Latin1;
|
||||
v.tagPocessing.preferredEncoding = TagParser::TagTextEncoding::Latin1;
|
||||
break;
|
||||
case 2:
|
||||
v.tagPocessing.preferredEncoding = Media::TagTextEncoding::Utf16BigEndian;
|
||||
v.tagPocessing.preferredEncoding = TagParser::TagTextEncoding::Utf16BigEndian;
|
||||
break;
|
||||
case 3:
|
||||
v.tagPocessing.preferredEncoding = Media::TagTextEncoding::Utf16LittleEndian;
|
||||
v.tagPocessing.preferredEncoding = TagParser::TagTextEncoding::Utf16LittleEndian;
|
||||
break;
|
||||
default:
|
||||
v.tagPocessing.preferredEncoding = Media::TagTextEncoding::Utf8;
|
||||
v.tagPocessing.preferredEncoding = TagParser::TagTextEncoding::Utf8;
|
||||
};
|
||||
switch(settings.value(QStringLiteral("unsupportedfieldhandling"), 0).toInt()) {
|
||||
case 1:
|
||||
|
|
|
@ -79,8 +79,8 @@ struct FileBrowser
|
|||
|
||||
struct Id3Processing
|
||||
{
|
||||
Media::TagUsage v1Usage = Media::TagUsage::Always;
|
||||
Media::TagUsage v2Usage = Media::TagUsage::Always;
|
||||
TagParser::TagUsage v1Usage = TagParser::TagUsage::Always;
|
||||
TagParser::TagUsage v2Usage = TagParser::TagUsage::Always;
|
||||
byte v2Version = 3;
|
||||
bool keepVersionOfExistingId3v2Tag = true;
|
||||
bool mergeMultipleSuccessiveId3v2Tags = true;
|
||||
|
@ -89,9 +89,9 @@ struct Id3Processing
|
|||
struct FileLayout
|
||||
{
|
||||
bool forceRewrite = true;
|
||||
Media::ElementPosition preferredTagPosition = Media::ElementPosition::BeforeData;
|
||||
TagParser::ElementPosition preferredTagPosition = TagParser::ElementPosition::BeforeData;
|
||||
bool forceTagPosition = true;
|
||||
Media::ElementPosition preferredIndexPosition = Media::ElementPosition::BeforeData;
|
||||
TagParser::ElementPosition preferredIndexPosition = TagParser::ElementPosition::BeforeData;
|
||||
bool forceIndexPosition = true;
|
||||
std::size_t minPadding = 0;
|
||||
std::size_t maxPadding = 0;
|
||||
|
@ -100,7 +100,7 @@ struct FileLayout
|
|||
|
||||
struct TagProcessing
|
||||
{
|
||||
Media::TagTextEncoding preferredEncoding = Media::TagTextEncoding::Utf8;
|
||||
TagParser::TagTextEncoding preferredEncoding = TagParser::TagTextEncoding::Utf8;
|
||||
UnsupportedFieldHandling unsupportedFieldHandling = UnsupportedFieldHandling::Ignore;
|
||||
bool autoTagManagement = true;
|
||||
Id3Processing id3;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <tagparser/tagtarget.h>
|
||||
|
||||
using namespace Models;
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
|
||||
namespace Settings {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include <QAbstractListModel>
|
||||
#include <QList>
|
||||
|
||||
namespace Media {
|
||||
namespace TagParser {
|
||||
DECLARE_ENUM_CLASS(TagTargetLevel, unsigned char);
|
||||
}
|
||||
|
||||
|
@ -22,9 +22,9 @@ public:
|
|||
MostUsefulTargets
|
||||
};
|
||||
|
||||
static const char *fieldName(Media::TagTargetLevel targetLevel);
|
||||
static QString translatedFieldName(Media::TagTargetLevel targetLevel);
|
||||
static Models::ChecklistItem mkItem(Media::TagTargetLevel targetLevel, Qt::CheckState checkState = Qt::Checked);
|
||||
static const char *fieldName(TagParser::TagTargetLevel targetLevel);
|
||||
static QString translatedFieldName(TagParser::TagTargetLevel targetLevel);
|
||||
static Models::ChecklistItem mkItem(TagParser::TagTargetLevel targetLevel, Qt::CheckState checkState = Qt::Checked);
|
||||
|
||||
explicit TargetLevelModel(QObject *parent = nullptr, DefaultSelection defaultSelection = DefaultSelection::None);
|
||||
explicit TargetLevelModel(const QList<Models::ChecklistItem> &items, QObject *parent = nullptr);
|
||||
|
@ -33,7 +33,7 @@ public:
|
|||
virtual QString labelForId(const QVariant &id) const;
|
||||
};
|
||||
|
||||
inline Models::ChecklistItem TargetLevelModel::mkItem(Media::TagTargetLevel field, Qt::CheckState checkState)
|
||||
inline Models::ChecklistItem TargetLevelModel::mkItem(TagParser::TagTargetLevel field, Qt::CheckState checkState)
|
||||
{
|
||||
return Models::ChecklistItem(static_cast<int>(field), translatedFieldName(field), checkState);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
using namespace std;
|
||||
using namespace ConversionUtilities;
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
|
||||
namespace Cli {
|
||||
|
||||
|
@ -38,7 +38,7 @@ void AttachmentInfo::parseDenotation(const char *denotation)
|
|||
}
|
||||
}
|
||||
|
||||
void AttachmentInfo::apply(AbstractContainer *container, Media::Diagnostics &diag)
|
||||
void AttachmentInfo::apply(AbstractContainer *container, TagParser::Diagnostics &diag)
|
||||
{
|
||||
static const string context("applying specified attachments");
|
||||
AbstractAttachment *attachment = nullptr;
|
||||
|
@ -108,7 +108,7 @@ void AttachmentInfo::apply(AbstractContainer *container, Media::Diagnostics &dia
|
|||
}
|
||||
}
|
||||
|
||||
void AttachmentInfo::apply(AbstractAttachment *attachment, Media::Diagnostics &diag)
|
||||
void AttachmentInfo::apply(AbstractAttachment *attachment, TagParser::Diagnostics &diag)
|
||||
{
|
||||
if(hasId) {
|
||||
attachment->setId(id);
|
||||
|
@ -135,7 +135,7 @@ void AttachmentInfo::reset()
|
|||
path = name = mime = desc = nullptr;
|
||||
}
|
||||
|
||||
bool AttachmentInfo::next(AbstractContainer *container, Media::Diagnostics &diag)
|
||||
bool AttachmentInfo::next(AbstractContainer *container, TagParser::Diagnostics &diag)
|
||||
{
|
||||
if(!id && !path && !name && !mime && !desc) {
|
||||
// skip empty attachment infos
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include <c++utilities/conversion/types.h>
|
||||
|
||||
namespace Media {
|
||||
namespace TagParser {
|
||||
class AbstractContainer;
|
||||
class AbstractAttachment;
|
||||
}
|
||||
|
@ -23,10 +23,10 @@ class AttachmentInfo
|
|||
public:
|
||||
AttachmentInfo();
|
||||
void parseDenotation(const char *denotation);
|
||||
void apply(Media::AbstractContainer *container, Media::Diagnostics &diag);
|
||||
void apply(Media::AbstractAttachment *attachment, Media::Diagnostics &diag);
|
||||
void apply(TagParser::AbstractContainer *container, TagParser::Diagnostics &diag);
|
||||
void apply(TagParser::AbstractAttachment *attachment, TagParser::Diagnostics &diag);
|
||||
void reset();
|
||||
bool next(Media::AbstractContainer *container, Media::Diagnostics &diag);
|
||||
bool next(TagParser::AbstractContainer *container, TagParser::Diagnostics &diag);
|
||||
|
||||
AttachmentAction action;
|
||||
uint64 id;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <tagparser/tag.h>
|
||||
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
|
||||
namespace Cli {
|
||||
namespace FieldMapping {
|
||||
|
@ -40,7 +40,7 @@ static constexpr struct {
|
|||
{"description", KnownField::Description},
|
||||
};
|
||||
|
||||
const char *fieldDenotation(Media::KnownField knownField)
|
||||
const char *fieldDenotation(TagParser::KnownField knownField)
|
||||
{
|
||||
for(const auto &mapping : fieldMapping) {
|
||||
if(mapping.knownField == knownField) {
|
||||
|
@ -50,7 +50,7 @@ const char *fieldDenotation(Media::KnownField knownField)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Media::KnownField knownField(const char *fieldDenotation, std::size_t fieldDenotationSize)
|
||||
TagParser::KnownField knownField(const char *fieldDenotation, std::size_t fieldDenotationSize)
|
||||
{
|
||||
for(const auto &mapping : fieldMapping) {
|
||||
if(!strncmp(fieldDenotation, mapping.knownDenotation, fieldDenotationSize)) {
|
||||
|
|
|
@ -3,15 +3,15 @@
|
|||
|
||||
#include <cstddef>
|
||||
|
||||
namespace Media {
|
||||
namespace TagParser {
|
||||
enum class KnownField : unsigned int;
|
||||
}
|
||||
|
||||
namespace Cli {
|
||||
namespace FieldMapping {
|
||||
|
||||
const char *fieldDenotation(Media::KnownField knownField);
|
||||
Media::KnownField knownField(const char *fieldDenotation, std::size_t fieldDenotationSize);
|
||||
const char *fieldDenotation(TagParser::KnownField knownField);
|
||||
TagParser::KnownField knownField(const char *fieldDenotation, std::size_t fieldDenotationSize);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ using namespace std::placeholders;
|
|||
using namespace ApplicationUtilities;
|
||||
using namespace ConversionUtilities;
|
||||
using namespace ChronoUtilities;
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
using namespace Settings;
|
||||
using namespace EscapeCodes;
|
||||
|
||||
|
@ -666,7 +666,7 @@ void logNextStep(const AbortableProgressFeedback &progress)
|
|||
logLineFinalized = false;
|
||||
}
|
||||
|
||||
void logStepPercentage(const Media::AbortableProgressFeedback &progress)
|
||||
void logStepPercentage(const TagParser::AbortableProgressFeedback &progress)
|
||||
{
|
||||
cout << "\r - [" << setw(3) << static_cast<unsigned int>(progress.stepPercentage()) << "%] " << lastStep << flush;
|
||||
}
|
||||
|
|
10
cli/helper.h
10
cli/helper.h
|
@ -20,7 +20,7 @@ namespace ApplicationUtilities {
|
|||
class Argument;
|
||||
}
|
||||
|
||||
namespace Media {
|
||||
namespace TagParser {
|
||||
class MediaFileInfo;
|
||||
class Diagnostics;
|
||||
class AbortableProgressFeedback;
|
||||
|
@ -28,7 +28,7 @@ enum class TagUsage;
|
|||
enum class ElementPosition;
|
||||
}
|
||||
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
|
||||
namespace Cli {
|
||||
|
||||
|
@ -265,7 +265,7 @@ constexpr bool isDigit(char c)
|
|||
|
||||
std::string incremented(const std::string &str, unsigned int toIncrement = 1);
|
||||
|
||||
void printDiagMessages(const Media::Diagnostics &diag, const char *head = nullptr, bool beVerbose = false);
|
||||
void printDiagMessages(const TagParser::Diagnostics &diag, const char *head = nullptr, bool beVerbose = false);
|
||||
void printProperty(const char *propName, const char *value, const char *suffix = nullptr, ApplicationUtilities::Indentation indentation = 4);
|
||||
void printProperty(const char *propName, ElementPosition elementPosition, const char *suffix = nullptr, ApplicationUtilities::Indentation indentation = 4);
|
||||
|
||||
|
@ -311,8 +311,8 @@ FieldDenotations parseFieldDenotations(const ApplicationUtilities::Argument &fie
|
|||
std::string tagName(const Tag *tag);
|
||||
bool stringToBool(const std::string &str);
|
||||
extern bool logLineFinalized;
|
||||
void logNextStep(const Media::AbortableProgressFeedback &progress);
|
||||
void logStepPercentage(const Media::AbortableProgressFeedback &progress);
|
||||
void logNextStep(const TagParser::AbortableProgressFeedback &progress);
|
||||
void logStepPercentage(const TagParser::AbortableProgressFeedback &progress);
|
||||
void finalizeLog();
|
||||
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <c++utilities/conversion/stringconversion.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
|
||||
namespace ReflectiveRapidJSON {
|
||||
namespace JsonReflector {
|
||||
|
@ -36,7 +36,7 @@ namespace Json {
|
|||
/*!
|
||||
* \brief Converts the specified Media::TagValue to an object suitable for JSON serialization.
|
||||
*/
|
||||
TagValue::TagValue(const Media::TagValue &tagValue, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator)
|
||||
TagValue::TagValue(const TagParser::TagValue &tagValue, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator)
|
||||
: mimeType(tagValue.mimeType())
|
||||
{
|
||||
if (tagValue.isEmpty()) {
|
||||
|
@ -135,7 +135,7 @@ TagInfo::TagInfo(const Tag &tag, RAPIDJSON_NAMESPACE::Document::AllocatorType &a
|
|||
* \brief Copies relevant information from Media::MediaFileInfo for serialization.
|
||||
* \remarks The \a mediaFileInfo must have been parsed before.
|
||||
*/
|
||||
FileInfo::FileInfo(const Media::MediaFileInfo &mediaFileInfo, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator)
|
||||
FileInfo::FileInfo(const TagParser::MediaFileInfo &mediaFileInfo, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator)
|
||||
: fileName(mediaFileInfo.fileName())
|
||||
, size(mediaFileInfo.size())
|
||||
, mimeType(mediaFileInfo.mimeType())
|
||||
|
|
12
cli/json.h
12
cli/json.h
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <unordered_map>
|
||||
|
||||
namespace Media {
|
||||
namespace TagParser {
|
||||
class MediaFileInfo;
|
||||
class Tag;
|
||||
class TagValue;
|
||||
|
@ -19,7 +19,7 @@ namespace Cli {
|
|||
namespace Json {
|
||||
|
||||
struct TagValue : ReflectiveRapidJSON::JsonSerializable<TagValue> {
|
||||
TagValue(const Media::TagValue &tagValue, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator);
|
||||
TagValue(const TagParser::TagValue &tagValue, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator);
|
||||
|
||||
const char *kind = "undefined";
|
||||
const std::string mimeType;
|
||||
|
@ -28,8 +28,8 @@ struct TagValue : ReflectiveRapidJSON::JsonSerializable<TagValue> {
|
|||
};
|
||||
|
||||
struct TargetInfo : ReflectiveRapidJSON::JsonSerializable<TargetInfo> {
|
||||
using IdContainerType = Media::TagTarget::IdContainerType;
|
||||
TargetInfo(const Media::TagTarget &tagTarget, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator);
|
||||
using IdContainerType = TagParser::TagTarget::IdContainerType;
|
||||
TargetInfo(const TagParser::TagTarget &tagTarget, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator);
|
||||
|
||||
uint64 level;
|
||||
std::string levelName;
|
||||
|
@ -40,7 +40,7 @@ struct TargetInfo : ReflectiveRapidJSON::JsonSerializable<TargetInfo> {
|
|||
};
|
||||
|
||||
struct TagInfo : ReflectiveRapidJSON::JsonSerializable<TagInfo> {
|
||||
TagInfo(const Media::Tag &tag, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator);
|
||||
TagInfo(const TagParser::Tag &tag, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator);
|
||||
|
||||
const char *format = nullptr;
|
||||
TargetInfo target;
|
||||
|
@ -48,7 +48,7 @@ struct TagInfo : ReflectiveRapidJSON::JsonSerializable<TagInfo> {
|
|||
};
|
||||
|
||||
struct FileInfo : ReflectiveRapidJSON::JsonSerializable<FileInfo> {
|
||||
FileInfo(const Media::MediaFileInfo &mediaFileInfo, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator);
|
||||
FileInfo(const TagParser::MediaFileInfo &mediaFileInfo, RAPIDJSON_NAMESPACE::Document::AllocatorType &allocator);
|
||||
|
||||
std::string fileName;
|
||||
std::size_t size;
|
||||
|
|
|
@ -58,7 +58,7 @@ using namespace ChronoUtilities;
|
|||
using namespace IoUtilities;
|
||||
using namespace EscapeCodes;
|
||||
using namespace Settings;
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
#if defined(TAGEDITOR_GUI_QTWIDGETS) || defined(TAGEDITOR_GUI_QTQUICK)
|
||||
using namespace Utility;
|
||||
#endif
|
||||
|
@ -125,7 +125,7 @@ void generateFileInfo(const ArgumentOccurrence &, const Argument &inputFileArg,
|
|||
} else {
|
||||
cerr << Phrases::Error << "An IO error occured when writing the file \"" << outputFileArg.values().front() << "\"." << Phrases::EndFlush;
|
||||
}
|
||||
} catch(const Media::Failure &) {
|
||||
} catch(const TagParser::Failure &) {
|
||||
cerr << Phrases::Error << "A parsing failure occured when reading the file \"" << inputFileArg.values().front() << "\"." << Phrases::EndFlush;
|
||||
} catch(...) {
|
||||
::IoUtilities::catchIoFailure();
|
||||
|
@ -294,7 +294,7 @@ void displayFileInfo(const ArgumentOccurrence &, const Argument &filesArg, const
|
|||
}
|
||||
}
|
||||
|
||||
} catch(const Media::Failure &) {
|
||||
} catch(const TagParser::Failure &) {
|
||||
cerr << Phrases::Error << "A parsing failure occured when reading the file \"" << file << "\"." << Phrases::EndFlush;
|
||||
} catch(...) {
|
||||
::IoUtilities::catchIoFailure();
|
||||
|
@ -354,7 +354,7 @@ void displayTagInfo(const Argument &fieldsArg, const Argument &filesArg, const A
|
|||
} else {
|
||||
cout << " - File has no (supported) tag information.\n";
|
||||
}
|
||||
} catch(const Media::Failure &) {
|
||||
} catch(const TagParser::Failure &) {
|
||||
cerr << Phrases::Error << "A parsing failure occured when reading the file \"" << file << "\"." << Phrases::EndFlush;
|
||||
} catch(...) {
|
||||
::IoUtilities::catchIoFailure();
|
||||
|
@ -568,7 +568,7 @@ void setTagInfo(const SetTagInfoArgs &args)
|
|||
TagValue value(move(buff), fileInfo.size(), TagDataType::Picture);
|
||||
value.setMimeType(fileInfo.mimeType());
|
||||
convertedValues.emplace_back(move(value));
|
||||
} catch(const Media::Failure &) {
|
||||
} catch(const TagParser::Failure &) {
|
||||
diag.emplace_back(DiagLevel::Critical, "Unable to parse specified cover file.", context);
|
||||
} catch(...) {
|
||||
::IoUtilities::catchIoFailure();
|
||||
|
@ -696,15 +696,15 @@ void setTagInfo(const SetTagInfoArgs &args)
|
|||
// notify about completion
|
||||
finalizeLog();
|
||||
cout << " - Changes have been applied." << endl;
|
||||
} catch(const Media::OperationAbortedException &) {
|
||||
} catch(const TagParser::OperationAbortedException &) {
|
||||
finalizeLog();
|
||||
cerr << Phrases::Warning << "The operation has been aborted." << Phrases::EndFlush;
|
||||
return;
|
||||
} catch(const Media::Failure &) {
|
||||
} catch(const TagParser::Failure &) {
|
||||
finalizeLog();
|
||||
cerr << " - " << Phrases::Error << "Failed to apply changes." << Phrases::EndFlush;
|
||||
}
|
||||
} catch(const Media::Failure &) {
|
||||
} catch(const TagParser::Failure &) {
|
||||
finalizeLog();
|
||||
cerr << " - " << Phrases::Error << "A parsing failure occured when reading/writing the file \"" << file << "\"." << Phrases::EndFlush;
|
||||
} catch(...) {
|
||||
|
@ -849,7 +849,7 @@ void extractField(const Argument &fieldArg, const Argument &attachmentArg, const
|
|||
}
|
||||
}
|
||||
|
||||
} catch(const Media::Failure &) {
|
||||
} catch(const TagParser::Failure &) {
|
||||
cerr << Phrases::Error << "A parsing failure occured when reading the file \"" << file << "\"." << Phrases::End;
|
||||
} catch(...) {
|
||||
::IoUtilities::catchIoFailure();
|
||||
|
@ -885,7 +885,7 @@ void exportToJson(const ArgumentOccurrence &, const Argument &filesArg, const Ar
|
|||
fileInfo.parseTags(diag);
|
||||
fileInfo.parseTracks(diag);
|
||||
jsonData.emplace_back(fileInfo, document.GetAllocator());
|
||||
} catch(const Media::Failure &) {
|
||||
} catch(const TagParser::Failure &) {
|
||||
cerr << Phrases::Error << "A parsing failure occured when reading the file \"" << file << "\"." << Phrases::EndFlush;
|
||||
} catch(...) {
|
||||
::IoUtilities::catchIoFailure();
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
using namespace std;
|
||||
using namespace Utility;
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
|
||||
namespace QtGui {
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
QT_FORWARD_DECLARE_CLASS(QNetworkReply)
|
||||
|
||||
namespace Media {
|
||||
namespace TagParser {
|
||||
class TagValue;
|
||||
DECLARE_ENUM_CLASS(KnownField, unsigned int);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public:
|
|||
const QStringList &errorList() const;
|
||||
bool areResultsAvailable() const;
|
||||
bool isFetchingCover() const;
|
||||
Media::TagValue fieldValue(int row, Media::KnownField knownField) const;
|
||||
TagParser::TagValue fieldValue(int row, TagParser::KnownField knownField) const;
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
using namespace std;
|
||||
using namespace IoUtilities;
|
||||
using namespace ConversionUtilities;
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
|
||||
namespace QtGui {
|
||||
|
||||
|
@ -48,7 +48,7 @@ AttachmentsEdit::AttachmentsEdit(MediaFileInfo *fileInfo, QWidget *parent) :
|
|||
AttachmentsEdit::~AttachmentsEdit()
|
||||
{}
|
||||
|
||||
void AttachmentsEdit::setFileInfo(Media::MediaFileInfo *fileInfo, bool updateUi)
|
||||
void AttachmentsEdit::setFileInfo(TagParser::MediaFileInfo *fileInfo, bool updateUi)
|
||||
{
|
||||
m_fileInfo = fileInfo;
|
||||
m_currentAttachments.clear();
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
namespace Media {
|
||||
namespace TagParser {
|
||||
class MediaFileInfo;
|
||||
class AbstractAttachment;
|
||||
}
|
||||
|
@ -23,12 +23,12 @@ class AttachmentsEdit : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AttachmentsEdit(Media::MediaFileInfo *fileInfo, QWidget *parent = nullptr);
|
||||
explicit AttachmentsEdit(TagParser::MediaFileInfo *fileInfo, QWidget *parent = nullptr);
|
||||
~AttachmentsEdit();
|
||||
|
||||
Media::MediaFileInfo *fileInfo();
|
||||
void setFileInfo(Media::MediaFileInfo *fileInfo, bool updateUi = true);
|
||||
const QList<Media::AbstractAttachment *> ¤tAttachments() const;
|
||||
TagParser::MediaFileInfo *fileInfo();
|
||||
void setFileInfo(TagParser::MediaFileInfo *fileInfo, bool updateUi = true);
|
||||
const QList<TagParser::AbstractAttachment *> ¤tAttachments() const;
|
||||
|
||||
public slots:
|
||||
void clear();
|
||||
|
@ -47,18 +47,18 @@ private:
|
|||
void setupUi();
|
||||
|
||||
std::unique_ptr<Ui::AttachmentsEdit> m_ui;
|
||||
Media::MediaFileInfo *m_fileInfo;
|
||||
QList<Media::AbstractAttachment *> m_currentAttachments;
|
||||
QList<Media::AbstractAttachment *> m_addedAttachments;
|
||||
TagParser::MediaFileInfo *m_fileInfo;
|
||||
QList<TagParser::AbstractAttachment *> m_currentAttachments;
|
||||
QList<TagParser::AbstractAttachment *> m_addedAttachments;
|
||||
AttachmentsModel *m_model;
|
||||
};
|
||||
|
||||
inline Media::MediaFileInfo *AttachmentsEdit::fileInfo()
|
||||
inline TagParser::MediaFileInfo *AttachmentsEdit::fileInfo()
|
||||
{
|
||||
return m_fileInfo;
|
||||
}
|
||||
|
||||
inline const QList<Media::AbstractAttachment *> &AttachmentsEdit::currentAttachments() const
|
||||
inline const QList<TagParser::AbstractAttachment *> &AttachmentsEdit::currentAttachments() const
|
||||
{
|
||||
return m_currentAttachments;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <QApplication>
|
||||
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
using namespace ConversionUtilities;
|
||||
|
||||
namespace QtGui {
|
||||
|
@ -27,12 +27,12 @@ AttachmentItem::AttachmentItem(AbstractAttachment *attachment, bool activated, c
|
|||
}
|
||||
}
|
||||
|
||||
Media::AbstractAttachment *AttachmentItem::attachment()
|
||||
TagParser::AbstractAttachment *AttachmentItem::attachment()
|
||||
{
|
||||
return m_attachment;
|
||||
}
|
||||
|
||||
const Media::AbstractAttachment *AttachmentItem::attachment() const
|
||||
const TagParser::AbstractAttachment *AttachmentItem::attachment() const
|
||||
{
|
||||
return m_attachment;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <QAbstractTableModel>
|
||||
|
||||
namespace Media {
|
||||
namespace TagParser {
|
||||
class AbstractAttachment;
|
||||
}
|
||||
|
||||
|
@ -12,10 +12,10 @@ namespace QtGui {
|
|||
class AttachmentItem
|
||||
{
|
||||
public:
|
||||
AttachmentItem(Media::AbstractAttachment *attachment, bool activated = true, const QString &location = QString());
|
||||
AttachmentItem(TagParser::AbstractAttachment *attachment, bool activated = true, const QString &location = QString());
|
||||
|
||||
Media::AbstractAttachment *attachment();
|
||||
const Media::AbstractAttachment *attachment() const;
|
||||
TagParser::AbstractAttachment *attachment();
|
||||
const TagParser::AbstractAttachment *attachment() const;
|
||||
const QString &name() const;
|
||||
void setName(const QString &name);
|
||||
const QString &description() const;
|
||||
|
@ -31,7 +31,7 @@ public:
|
|||
void submit();
|
||||
|
||||
private:
|
||||
Media::AbstractAttachment *m_attachment;
|
||||
TagParser::AbstractAttachment *m_attachment;
|
||||
QString m_name;
|
||||
QString m_description;
|
||||
QString m_mimeType;
|
||||
|
@ -58,9 +58,9 @@ public:
|
|||
bool submit();
|
||||
void repealSelection();
|
||||
|
||||
Media::AbstractAttachment *attachment(const QModelIndex &index);
|
||||
void addAttachment(int row, Media::AbstractAttachment *attachment, bool activated = true, const QString &location = QString());
|
||||
void setAttachments(const QList<Media::AbstractAttachment *> &attachments, bool activated = true, const QString &location = QString());
|
||||
TagParser::AbstractAttachment *attachment(const QModelIndex &index);
|
||||
void addAttachment(int row, TagParser::AbstractAttachment *attachment, bool activated = true, const QString &location = QString());
|
||||
void setAttachments(const QList<TagParser::AbstractAttachment *> &attachments, bool activated = true, const QString &location = QString());
|
||||
void removeAttachments(int firstRow, int lastRow);
|
||||
|
||||
private:
|
||||
|
|
|
@ -32,7 +32,7 @@ using namespace Dialogs;
|
|||
using namespace Models;
|
||||
using namespace Settings;
|
||||
using namespace Utility;
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
|
||||
namespace QtGui {
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
using namespace std;
|
||||
using namespace Models;
|
||||
using namespace Dialogs;
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
|
||||
namespace QtGui {
|
||||
|
||||
|
@ -93,7 +93,7 @@ void EnterTargetDialog::updateLevelNamePlaceholderText(int i)
|
|||
m_ui->levelNameLineEdit->setPlaceholderText(levelName ? QString::fromUtf8(levelName) : QString());
|
||||
}
|
||||
|
||||
Media::TagTarget EnterTargetDialog::target() const
|
||||
TagParser::TagTarget EnterTargetDialog::target() const
|
||||
{
|
||||
TagTarget target;
|
||||
target.setLevel(static_cast<uint64>(m_ui->levelSpinBox->value()));
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Models {
|
|||
class ChecklistModel;
|
||||
}
|
||||
|
||||
namespace Media {
|
||||
namespace TagParser {
|
||||
class MediaFileInfo;
|
||||
enum class ContainerFormat;
|
||||
}
|
||||
|
@ -25,14 +25,14 @@ class EnterTargetDialog;
|
|||
class EnterTargetDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(Media::TagTarget target READ target WRITE setTarget)
|
||||
Q_PROPERTY(TagParser::TagTarget target READ target WRITE setTarget)
|
||||
|
||||
public:
|
||||
explicit EnterTargetDialog(QWidget *parent = nullptr);
|
||||
~EnterTargetDialog();
|
||||
|
||||
Media::TagTarget target() const;
|
||||
void setTarget(const Media::TagTarget &target, const Media::MediaFileInfo *file = nullptr);
|
||||
TagParser::TagTarget target() const;
|
||||
void setTarget(const TagParser::TagTarget &target, const TagParser::MediaFileInfo *file = nullptr);
|
||||
|
||||
private slots:
|
||||
void updateLevelNamePlaceholderText(int i);
|
||||
|
@ -43,7 +43,7 @@ private:
|
|||
Models::ChecklistModel *m_chaptersModel;
|
||||
Models::ChecklistModel *m_editionsModel;
|
||||
Models::ChecklistModel *m_attachmentsModel;
|
||||
Media::ContainerFormat m_currentContainerFormat;
|
||||
TagParser::ContainerFormat m_currentContainerFormat;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
using namespace std;
|
||||
using namespace ChronoUtilities;
|
||||
using namespace ConversionUtilities;
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
using namespace Utility;
|
||||
|
||||
namespace QtGui {
|
||||
|
@ -116,7 +116,7 @@ private:
|
|||
QStandardItem *m_item;
|
||||
};
|
||||
|
||||
void addDiagMessages(Media::Diagnostics *diag, QStandardItem *parent)
|
||||
void addDiagMessages(TagParser::Diagnostics *diag, QStandardItem *parent)
|
||||
{
|
||||
for(const auto &msg : *diag) {
|
||||
QList<QStandardItem *> notificationRow;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include <list>
|
||||
|
||||
namespace Media {
|
||||
namespace TagParser {
|
||||
class MediaFileInfo;
|
||||
class Diagnostics;
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ public:
|
|||
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
||||
|
||||
const Media::MediaFileInfo *fileInfo() const;
|
||||
void setFileInfo(Media::MediaFileInfo &fileInfo, Media::Diagnostics &diag, Media::Diagnostics *diagReparsing = nullptr);
|
||||
const TagParser::MediaFileInfo *fileInfo() const;
|
||||
void setFileInfo(TagParser::MediaFileInfo &fileInfo, TagParser::Diagnostics &diag, TagParser::Diagnostics *diagReparsing = nullptr);
|
||||
|
||||
#if defined(GUI_QTWIDGETS)
|
||||
static const QIcon &informationIcon();
|
||||
|
@ -34,9 +34,9 @@ private:
|
|||
void updateCache();
|
||||
|
||||
private:
|
||||
Media::MediaFileInfo *m_file;
|
||||
Media::Diagnostics *m_diag;
|
||||
Media::Diagnostics *m_diagReparsing;
|
||||
TagParser::MediaFileInfo *m_file;
|
||||
TagParser::Diagnostics *m_diag;
|
||||
TagParser::Diagnostics *m_diagReparsing;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
using namespace std;
|
||||
using namespace Utility;
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
using namespace Dialogs;
|
||||
using namespace Widgets;
|
||||
using namespace ThreadingUtils;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
QT_FORWARD_DECLARE_CLASS(QFileSystemModel)
|
||||
QT_FORWARD_DECLARE_CLASS(QItemSelectionModel)
|
||||
|
||||
namespace Media {
|
||||
namespace TagParser {
|
||||
DECLARE_ENUM_CLASS(TagType, unsigned int);
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ private slots:
|
|||
|
||||
private:
|
||||
bool fileOperationOngoing() const;
|
||||
Media::MediaFileInfo &fileInfo();
|
||||
TagParser::MediaFileInfo &fileInfo();
|
||||
|
||||
// UI
|
||||
std::unique_ptr<Ui::MainWindow> m_ui;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
using namespace std;
|
||||
using namespace ChronoUtilities;
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
using namespace Utility;
|
||||
|
||||
namespace QtGui {
|
||||
|
@ -119,7 +119,7 @@ const Diagnostics &DiagModel::diagnostics() const
|
|||
return m_diag;
|
||||
}
|
||||
|
||||
void DiagModel::setDiagnostics(const Media::Diagnostics ¬ifications)
|
||||
void DiagModel::setDiagnostics(const TagParser::Diagnostics ¬ifications)
|
||||
{
|
||||
beginResetModel();
|
||||
m_diag = notifications;
|
||||
|
|
|
@ -19,8 +19,8 @@ public:
|
|||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
||||
|
||||
const Media::Diagnostics &diagnostics() const;
|
||||
void setDiagnostics(const Media::Diagnostics &diagnostics);
|
||||
const TagParser::Diagnostics &diagnostics() const;
|
||||
void setDiagnostics(const TagParser::Diagnostics &diagnostics);
|
||||
|
||||
static const QIcon &informationIcon();
|
||||
static const QIcon &warningIcon();
|
||||
|
@ -32,7 +32,7 @@ signals:
|
|||
public slots:
|
||||
|
||||
private:
|
||||
Media::Diagnostics m_diag;
|
||||
TagParser::Diagnostics m_diag;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include <memory>
|
||||
|
||||
using namespace std;
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
using namespace ConversionUtilities;
|
||||
|
||||
namespace QtGui {
|
||||
|
@ -110,7 +110,7 @@ bool fieldPredicate(int i, const std::pair<typename TagType::IdentifierType, typ
|
|||
* \param previousValueHandling Specifies the "previous value handling policy".
|
||||
*/
|
||||
template<class TagType>
|
||||
int fetchId3v2CoverValues(const TagType *tag, KnownField field, QList<Media::TagValue> &values, const int valueCount, const PreviousValueHandling previousValueHandling)
|
||||
int fetchId3v2CoverValues(const TagType *tag, KnownField field, QList<TagParser::TagValue> &values, const int valueCount, const PreviousValueHandling previousValueHandling)
|
||||
{
|
||||
values.reserve(valueCount);
|
||||
int first = -1;
|
||||
|
@ -232,7 +232,7 @@ void PicturePreviewSelection::setup(PreviousValueHandling previousValueHandling)
|
|||
* \param values Specifies the values to be pushed.
|
||||
*/
|
||||
template<class TagType>
|
||||
void pushId3v2CoverValues(TagType *tag, KnownField field, const QList<Media::TagValue> &values)
|
||||
void pushId3v2CoverValues(TagType *tag, KnownField field, const QList<TagParser::TagValue> &values)
|
||||
{
|
||||
auto &fields = tag->fields();
|
||||
const auto id = tag->fieldId(field);
|
||||
|
@ -337,7 +337,7 @@ void PicturePreviewSelection::addOfSelectedType(const QString &path)
|
|||
emit pictureChanged();
|
||||
}
|
||||
}
|
||||
} catch (const Media::Failure &) {
|
||||
} catch (const TagParser::Failure &) {
|
||||
QMessageBox::critical(this, QApplication::applicationName(), tr("Unable to parse specified cover file."));
|
||||
} catch(...) {
|
||||
::IoUtilities::catchIoFailure();
|
||||
|
|
|
@ -15,7 +15,7 @@ QT_FORWARD_DECLARE_CLASS(QGraphicsTextItem)
|
|||
QT_FORWARD_DECLARE_CLASS(QGraphicsPixmapItem)
|
||||
QT_FORWARD_DECLARE_CLASS(QGraphicsRectItem)
|
||||
|
||||
namespace Media {
|
||||
namespace TagParser {
|
||||
class Tag;
|
||||
class TagValue;
|
||||
DECLARE_ENUM_CLASS(KnownField, unsigned int);
|
||||
|
@ -34,15 +34,15 @@ class PicturePreviewSelection : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit PicturePreviewSelection(Media::Tag *tag = nullptr, Media::KnownField field = Media::KnownField::Invalid, QWidget *parent = nullptr);
|
||||
explicit PicturePreviewSelection(TagParser::Tag *tag = nullptr, TagParser::KnownField field = TagParser::KnownField::Invalid, QWidget *parent = nullptr);
|
||||
~PicturePreviewSelection();
|
||||
|
||||
Media::Tag *tag() const;
|
||||
Media::KnownField field() const;
|
||||
TagParser::Tag *tag() const;
|
||||
TagParser::KnownField field() const;
|
||||
|
||||
public slots:
|
||||
void setTagField(Media::Tag *tag, Media::KnownField field, PreviousValueHandling previousValueHandling = PreviousValueHandling::Clear);
|
||||
void setValue(const Media::TagValue &value, PreviousValueHandling previousValueHandling = PreviousValueHandling::Clear);
|
||||
void setTagField(TagParser::Tag *tag, TagParser::KnownField field, PreviousValueHandling previousValueHandling = PreviousValueHandling::Clear);
|
||||
void setValue(const TagParser::TagValue &value, PreviousValueHandling previousValueHandling = PreviousValueHandling::Clear);
|
||||
|
||||
void apply();
|
||||
void clear();
|
||||
|
@ -79,9 +79,9 @@ private:
|
|||
QPixmap m_pixmap;
|
||||
QGraphicsPixmapItem *m_pixmapItem;
|
||||
QGraphicsRectItem *m_rectItem;
|
||||
Media::Tag *m_tag;
|
||||
Media::KnownField m_field;
|
||||
QList<Media::TagValue> m_values;
|
||||
TagParser::Tag *m_tag;
|
||||
TagParser::KnownField m_field;
|
||||
QList<TagParser::TagValue> m_values;
|
||||
int m_currentTypeIndex;
|
||||
};
|
||||
|
||||
|
@ -90,7 +90,7 @@ private:
|
|||
*
|
||||
* This might have been set initially using the constructor or using the setTagField() method.
|
||||
*/
|
||||
inline Media::Tag *PicturePreviewSelection::tag() const
|
||||
inline TagParser::Tag *PicturePreviewSelection::tag() const
|
||||
{
|
||||
return m_tag;
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ inline Media::Tag *PicturePreviewSelection::tag() const
|
|||
/*!
|
||||
* \brief Returns the field. This is commonly KnownField::Cover.
|
||||
*/
|
||||
inline Media::KnownField PicturePreviewSelection::field() const
|
||||
inline TagParser::KnownField PicturePreviewSelection::field() const
|
||||
{
|
||||
return m_field;
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ inline Media::KnownField PicturePreviewSelection::field() const
|
|||
*
|
||||
* If \a tag is nullptr the widget is disabled. The widget will be re-setup.
|
||||
*/
|
||||
inline void PicturePreviewSelection::setTagField(Media::Tag *tag, Media::KnownField field, PreviousValueHandling previousValueHandling)
|
||||
inline void PicturePreviewSelection::setTagField(TagParser::Tag *tag, TagParser::KnownField field, PreviousValueHandling previousValueHandling)
|
||||
{
|
||||
m_tag = tag;
|
||||
m_field = field;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
using namespace std;
|
||||
using namespace std::placeholders;
|
||||
using namespace Settings;
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
|
||||
namespace QtGui {
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
using namespace std;
|
||||
using namespace std::placeholders;
|
||||
using namespace ConversionUtilities;
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
|
||||
namespace QtGui {
|
||||
|
||||
|
@ -100,7 +100,7 @@ void TagEdit::setTags(const QList<Tag *> &tags, bool updateUi)
|
|||
/*!
|
||||
* \brief Sets the \a value for the specified \a field manually applying the specified \a previousValueHandling.
|
||||
*/
|
||||
bool TagEdit::setValue(KnownField field, const Media::TagValue &value, PreviousValueHandling previousValueHandling)
|
||||
bool TagEdit::setValue(KnownField field, const TagParser::TagValue &value, PreviousValueHandling previousValueHandling)
|
||||
{
|
||||
if(TagFieldEdit *edit = m_widgets.value(field, nullptr)) {
|
||||
return edit->setValue(value, previousValueHandling);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
QT_FORWARD_DECLARE_CLASS(QFormLayout)
|
||||
QT_FORWARD_DECLARE_CLASS(QVBoxLayout)
|
||||
|
||||
namespace Media {
|
||||
namespace TagParser {
|
||||
class Tag;
|
||||
class TagValue;
|
||||
DECLARE_ENUM_CLASS(KnownField, unsigned int);
|
||||
|
@ -31,16 +31,16 @@ class TagEdit : public QWidget
|
|||
|
||||
public:
|
||||
explicit TagEdit(QWidget *parent = nullptr);
|
||||
const QList<Media::Tag *> &tags() const;
|
||||
Media::TagValue value(Media::KnownField field, Media::TagTextEncoding encoding = Media::TagTextEncoding::Utf16LittleEndian) const;
|
||||
void setTag(Media::Tag *tag, bool updateUi = true);
|
||||
void setTags(const QList<Media::Tag *> &tags, bool updateUi = true);
|
||||
bool setValue(Media::KnownField field, const Media::TagValue &value, PreviousValueHandling previousValueHandling = PreviousValueHandling::Clear);
|
||||
template<class Container = std::initializer_list<Media::Tag *> > void setTags(const Container &tags, bool updateUi = true);
|
||||
bool hasField(Media::KnownField field) const;
|
||||
const QList<TagParser::Tag *> &tags() const;
|
||||
TagParser::TagValue value(TagParser::KnownField field, TagParser::TagTextEncoding encoding = TagParser::TagTextEncoding::Utf16LittleEndian) const;
|
||||
void setTag(TagParser::Tag *tag, bool updateUi = true);
|
||||
void setTags(const QList<TagParser::Tag *> &tags, bool updateUi = true);
|
||||
bool setValue(TagParser::KnownField field, const TagParser::TagValue &value, PreviousValueHandling previousValueHandling = PreviousValueHandling::Clear);
|
||||
template<class Container = std::initializer_list<TagParser::Tag *> > void setTags(const Container &tags, bool updateUi = true);
|
||||
bool hasField(TagParser::KnownField field) const;
|
||||
PreviousValueHandling previousValueHandling() const;
|
||||
void setPreviousValueHandling(PreviousValueHandling previousValueHandling);
|
||||
TagFieldEdit *tagFieldEdit(Media::KnownField field) const;
|
||||
TagFieldEdit *tagFieldEdit(TagParser::KnownField field) const;
|
||||
QString generateLabel() const;
|
||||
|
||||
public slots:
|
||||
|
@ -58,17 +58,17 @@ private:
|
|||
void removeEdit(QWidget *edit);
|
||||
void assignTags();
|
||||
|
||||
QList<Media::Tag *> m_tags;
|
||||
QList<TagParser::Tag *> m_tags;
|
||||
QFormLayout *m_layoutLeft;
|
||||
QVBoxLayout *m_layoutRight;
|
||||
QMap<Media::KnownField, TagFieldEdit *> m_widgets;
|
||||
QMap<TagParser::KnownField, TagFieldEdit *> m_widgets;
|
||||
PreviousValueHandling m_previousValueHandling;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Returns the currently assigned tags.
|
||||
*/
|
||||
inline const QList<Media::Tag *> &TagEdit::tags() const
|
||||
inline const QList<TagParser::Tag *> &TagEdit::tags() const
|
||||
{
|
||||
return m_tags;
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ inline void TagEdit::setPreviousValueHandling(PreviousValueHandling previousValu
|
|||
* \returns Returns a pointer to the object (ownership remains by the TagEdit object) or - if
|
||||
* there is no TagFieldEdit object - nullptr.
|
||||
*/
|
||||
inline TagFieldEdit *TagEdit::tagFieldEdit(Media::KnownField field) const
|
||||
inline TagFieldEdit *TagEdit::tagFieldEdit(TagParser::KnownField field) const
|
||||
{
|
||||
return m_widgets.value(field, nullptr);
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ using namespace std::placeholders;
|
|||
using namespace Utility;
|
||||
using namespace Dialogs;
|
||||
using namespace Widgets;
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
using namespace Models;
|
||||
using namespace ConversionUtilities;
|
||||
|
||||
|
@ -494,7 +494,7 @@ void TagEditorWidget::updateTagManagementMenu()
|
|||
case ContainerFormat::Webm:
|
||||
// tag format supports targets (Matroska tags are currently the only tag format supporting targets.)
|
||||
label = tr("Matroska tag");
|
||||
connect(m_addTagMenu->addAction(label), &QAction::triggered, std::bind(&TagEditorWidget::addTag, this, [this] (MediaFileInfo &file) -> Media::Tag * {
|
||||
connect(m_addTagMenu->addAction(label), &QAction::triggered, std::bind(&TagEditorWidget::addTag, this, [this] (MediaFileInfo &file) -> TagParser::Tag * {
|
||||
if(file.container()) {
|
||||
EnterTargetDialog targetDlg(this);
|
||||
targetDlg.setTarget(TagTarget(50), &this->m_fileInfo);
|
||||
|
@ -806,10 +806,10 @@ bool TagEditorWidget::startParsing(const QString &path, bool forceRefresh)
|
|||
result = IoError;
|
||||
}
|
||||
} catch(const exception &e) {
|
||||
diag.emplace_back(Media::DiagLevel::Critical, argsToString("Something completely unexpected happened: ", + e.what()), "parsing");
|
||||
diag.emplace_back(TagParser::DiagLevel::Critical, argsToString("Something completely unexpected happened: ", + e.what()), "parsing");
|
||||
result = FatalParsingError;
|
||||
} catch(...) {
|
||||
diag.emplace_back(Media::DiagLevel::Critical, "Something completely unexpected happened", "parsing");
|
||||
diag.emplace_back(TagParser::DiagLevel::Critical, "Something completely unexpected happened", "parsing");
|
||||
result = FatalParsingError;
|
||||
}
|
||||
QMetaObject::invokeMethod(this, "showFile", Qt::QueuedConnection, Q_ARG(char, result));
|
||||
|
@ -916,12 +916,12 @@ void TagEditorWidget::showFile(char result)
|
|||
m_ui->parsingNotificationWidget->setText(tr("File couldn't be parsed correctly."));
|
||||
}
|
||||
bool multipleSegmentsNotTested = m_fileInfo.containerFormat() == ContainerFormat::Matroska && m_fileInfo.container()->segmentCount() > 1;
|
||||
if(diagLevel >= Media::DiagLevel::Critical) {
|
||||
if(diagLevel >= TagParser::DiagLevel::Critical) {
|
||||
m_ui->parsingNotificationWidget->setNotificationType(NotificationType::Critical);
|
||||
m_ui->parsingNotificationWidget->appendLine(tr("Errors occured."));
|
||||
} else if(diagLevel == Media::DiagLevel::Warning || m_fileInfo.isReadOnly() || !m_fileInfo.areTagsSupported() || multipleSegmentsNotTested) {
|
||||
} else if(diagLevel == TagParser::DiagLevel::Warning || m_fileInfo.isReadOnly() || !m_fileInfo.areTagsSupported() || multipleSegmentsNotTested) {
|
||||
m_ui->parsingNotificationWidget->setNotificationType(NotificationType::Warning);
|
||||
if(diagLevel == Media::DiagLevel::Warning) {
|
||||
if(diagLevel == TagParser::DiagLevel::Warning) {
|
||||
m_ui->parsingNotificationWidget->appendLine(tr("There are warnings."));
|
||||
}
|
||||
}
|
||||
|
@ -1127,10 +1127,10 @@ bool TagEditorWidget::startSaving()
|
|||
ioError = true;
|
||||
}
|
||||
} catch(const exception &e) {
|
||||
m_diag.emplace_back(Media::DiagLevel::Critical, argsToString("Something completely unexpected happened: ", e.what()), "making");
|
||||
m_diag.emplace_back(TagParser::DiagLevel::Critical, argsToString("Something completely unexpected happened: ", e.what()), "making");
|
||||
processingError = true;
|
||||
} catch(...) {
|
||||
m_diag.emplace_back(Media::DiagLevel::Critical, "Something completely unexpected happened", "making");
|
||||
m_diag.emplace_back(TagParser::DiagLevel::Critical, "Something completely unexpected happened", "making");
|
||||
processingError = true;
|
||||
}
|
||||
QMetaObject::invokeMethod(this, "showSavingResult", Qt::QueuedConnection, Q_ARG(bool, processingError), Q_ARG(bool, ioError));
|
||||
|
@ -1164,11 +1164,11 @@ void TagEditorWidget::showSavingResult(bool processingError, bool ioError)
|
|||
size_t critical = 0, warnings = 0;
|
||||
for(const auto &msg : m_diag) {
|
||||
switch(msg.level()) {
|
||||
case Media::DiagLevel::Fatal:
|
||||
case Media::DiagLevel::Critical:
|
||||
case TagParser::DiagLevel::Fatal:
|
||||
case TagParser::DiagLevel::Critical:
|
||||
++critical;
|
||||
break;
|
||||
case Media::DiagLevel::Warning:
|
||||
case TagParser::DiagLevel::Warning:
|
||||
++warnings;
|
||||
break;
|
||||
default:
|
||||
|
@ -1388,7 +1388,7 @@ void TagEditorWidget::applySettingsFromDialog()
|
|||
*
|
||||
* Shows an error message if no file is opened. Tag edits, tag management menu und UI status will be updated.
|
||||
*/
|
||||
void TagEditorWidget::addTag(const function<Media::Tag *(Media::MediaFileInfo &)> &createTag)
|
||||
void TagEditorWidget::addTag(const function<TagParser::Tag *(TagParser::MediaFileInfo &)> &createTag)
|
||||
{
|
||||
if(m_fileOperationOngoing) {
|
||||
emit statusMessage("Unable to add a tag because the current process hasn't been finished yet.");
|
||||
|
|
|
@ -18,7 +18,7 @@ QT_FORWARD_DECLARE_CLASS(QTreeView)
|
|||
QT_FORWARD_DECLARE_CLASS(QFile)
|
||||
QT_FORWARD_DECLARE_CLASS(QTemporaryFile)
|
||||
|
||||
namespace Media {
|
||||
namespace TagParser {
|
||||
DECLARE_ENUM_CLASS(TagType, unsigned int);
|
||||
}
|
||||
|
||||
|
@ -49,8 +49,8 @@ public:
|
|||
bool fileOperationOngoing() const;
|
||||
const QString ¤tPath() const;
|
||||
const QString ¤tDir() const;
|
||||
Media::MediaFileInfo &fileInfo();
|
||||
const Media::Diagnostics &diagnostics() const;
|
||||
TagParser::MediaFileInfo &fileInfo();
|
||||
const TagParser::Diagnostics &diagnostics() const;
|
||||
bool isTagEditShown() const;
|
||||
const QByteArray &fileInfoHtml() const;
|
||||
const QByteArray &generateFileInfoHtml();
|
||||
|
@ -100,9 +100,9 @@ private slots:
|
|||
void showFile(char result);
|
||||
void handleReturnPressed();
|
||||
void handleKeepPreviousValuesActionTriggered(QAction *action);
|
||||
void addTag(const std::function<Media::Tag *(Media::MediaFileInfo &)> &createTag);
|
||||
void removeTag(Media::Tag *tag);
|
||||
void changeTarget(Media::Tag *tag);
|
||||
void addTag(const std::function<TagParser::Tag *(TagParser::MediaFileInfo &)> &createTag);
|
||||
void removeTag(TagParser::Tag *tag);
|
||||
void changeTarget(TagParser::Tag *tag);
|
||||
|
||||
// saving
|
||||
void showSavingResult(bool processingError, bool ioError);
|
||||
|
@ -143,16 +143,16 @@ private:
|
|||
QString m_currentPath;
|
||||
QFileSystemWatcher *m_fileWatcher;
|
||||
bool m_fileChangedOnDisk;
|
||||
Media::MediaFileInfo m_fileInfo;
|
||||
std::vector<Media::Tag *> m_tags;
|
||||
TagParser::MediaFileInfo m_fileInfo;
|
||||
std::vector<TagParser::Tag *> m_tags;
|
||||
QByteArray m_fileInfoHtml;
|
||||
QString m_fileName;
|
||||
QString m_currentDir;
|
||||
QString m_lastDir;
|
||||
QString m_saveFilePath;
|
||||
// status
|
||||
Media::Diagnostics m_diag;
|
||||
Media::Diagnostics m_diagReparsing;
|
||||
TagParser::Diagnostics m_diag;
|
||||
TagParser::Diagnostics m_diagReparsing;
|
||||
bool m_nextFileAfterSaving;
|
||||
bool m_makingResultsAvailable;
|
||||
bool m_abortClicked;
|
||||
|
@ -187,7 +187,7 @@ inline const QString &TagEditorWidget::currentDir() const
|
|||
/*!
|
||||
* \brief Return file info.
|
||||
*/
|
||||
inline Media::MediaFileInfo &TagEditorWidget::fileInfo()
|
||||
inline TagParser::MediaFileInfo &TagEditorWidget::fileInfo()
|
||||
{
|
||||
return m_fileInfo;
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ inline Media::MediaFileInfo &TagEditorWidget::fileInfo()
|
|||
/*!
|
||||
* \brief Returns the diagnostic messages.
|
||||
*/
|
||||
inline const Media::Diagnostics &TagEditorWidget::diagnostics() const
|
||||
inline const TagParser::Diagnostics &TagEditorWidget::diagnostics() const
|
||||
{
|
||||
return m_diag;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
using namespace std;
|
||||
using namespace Models;
|
||||
using namespace Widgets;
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
using namespace ConversionUtilities;
|
||||
|
||||
namespace QtGui {
|
||||
|
@ -58,7 +58,7 @@ namespace QtGui {
|
|||
* \brief Constructs a new TagFieldEdit.
|
||||
* \sa setTagField()
|
||||
*/
|
||||
TagFieldEdit::TagFieldEdit(const QList<Media::Tag *> &tags, Media::KnownField field, QWidget *parent) :
|
||||
TagFieldEdit::TagFieldEdit(const QList<TagParser::Tag *> &tags, TagParser::KnownField field, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
m_layout(new QVBoxLayout(this)),
|
||||
m_tags(&tags),
|
||||
|
@ -83,7 +83,7 @@ TagFieldEdit::TagFieldEdit(const QList<Media::Tag *> &tags, Media::KnownField fi
|
|||
*
|
||||
* If \a preventUiUpdate is true, the UI will not be updated.
|
||||
*/
|
||||
void TagFieldEdit::setTagField(const QList<Tag *> &tags, Media::KnownField field, PreviousValueHandling previousValueHandling, bool preventUiUpdate)
|
||||
void TagFieldEdit::setTagField(const QList<Tag *> &tags, TagParser::KnownField field, PreviousValueHandling previousValueHandling, bool preventUiUpdate)
|
||||
{
|
||||
bool uiRebuildingRequired = false;
|
||||
m_tags = &tags;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
QT_FORWARD_DECLARE_CLASS(QVBoxLayout)
|
||||
QT_FORWARD_DECLARE_CLASS(QLabel)
|
||||
|
||||
namespace Media {
|
||||
namespace TagParser {
|
||||
class TagValue;
|
||||
class Tag;
|
||||
DECLARE_ENUM_CLASS(KnownField, unsigned int);
|
||||
|
@ -37,15 +37,15 @@ class TagFieldEdit : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TagFieldEdit(const QList<Media::Tag *> &tags, Media::KnownField field, QWidget *parent = nullptr);
|
||||
explicit TagFieldEdit(const QList<TagParser::Tag *> &tags, TagParser::KnownField field, QWidget *parent = nullptr);
|
||||
|
||||
const QList<Media::Tag *> &tags() const;
|
||||
Media::KnownField field() const;
|
||||
void setTagField(const QList<Media::Tag *> &tags, Media::KnownField field, PreviousValueHandling previousValueHandling = PreviousValueHandling::Clear, bool preventUiUpdate = false);
|
||||
Media::TagValue value(Media::TagTextEncoding encoding, bool includeDescription) const;
|
||||
bool setValue(const Media::TagValue &value, PreviousValueHandling previousValueHandling = PreviousValueHandling::Clear);
|
||||
const QList<TagParser::Tag *> &tags() const;
|
||||
TagParser::KnownField field() const;
|
||||
void setTagField(const QList<TagParser::Tag *> &tags, TagParser::KnownField field, PreviousValueHandling previousValueHandling = PreviousValueHandling::Clear, bool preventUiUpdate = false);
|
||||
TagParser::TagValue value(TagParser::TagTextEncoding encoding, bool includeDescription) const;
|
||||
bool setValue(const TagParser::TagValue &value, PreviousValueHandling previousValueHandling = PreviousValueHandling::Clear);
|
||||
bool hasDescription() const;
|
||||
bool canApply(Media::KnownField field) const;
|
||||
bool canApply(TagParser::KnownField field) const;
|
||||
|
||||
public slots:
|
||||
void clear();
|
||||
|
@ -64,7 +64,7 @@ private slots:
|
|||
void handleRestoreButtonDestroyed(QObject *obj = nullptr);
|
||||
|
||||
private:
|
||||
Media::TagDataType determineDataType();
|
||||
TagParser::TagDataType determineDataType();
|
||||
void setupUi();
|
||||
Widgets::ClearLineEdit *setupLineEdit();
|
||||
Widgets::ClearPlainTextEdit *setupPlainTextEdit();
|
||||
|
@ -76,17 +76,17 @@ private:
|
|||
Widgets::ClearLineEdit *setupDescriptionLineEdit();
|
||||
QLabel *setupTypeNotSupportedLabel();
|
||||
void updateValue(PreviousValueHandling previousValueHandling = PreviousValueHandling::Clear);
|
||||
void updateValue(Media::Tag *tag, PreviousValueHandling previousValueHandling = PreviousValueHandling::Clear);
|
||||
void updateValue(const Media::TagValue &value, PreviousValueHandling previousValueHandling = PreviousValueHandling::Clear, bool resetRestoreButton = true);
|
||||
void updateValue(TagParser::Tag *tag, PreviousValueHandling previousValueHandling = PreviousValueHandling::Clear);
|
||||
void updateValue(const TagParser::TagValue &value, PreviousValueHandling previousValueHandling = PreviousValueHandling::Clear, bool resetRestoreButton = true);
|
||||
Widgets::IconButton *setupRestoreButton();
|
||||
void showRestoreButton();
|
||||
void applyAutoCorrection(QString &textValue);
|
||||
void concretizePreviousValueHandling(PreviousValueHandling &previousValueHandling);
|
||||
|
||||
QVBoxLayout *m_layout;
|
||||
const QList<Media::Tag *> *m_tags;
|
||||
Media::KnownField m_field;
|
||||
Media::TagDataType m_dataType;
|
||||
const QList<TagParser::Tag *> *m_tags;
|
||||
TagParser::KnownField m_field;
|
||||
TagParser::TagDataType m_dataType;
|
||||
QList<QWidget *> m_widgets;
|
||||
Widgets::ClearLineEdit *m_lineEdit;
|
||||
Widgets::ClearComboBox *m_comboBox;
|
||||
|
@ -98,12 +98,12 @@ private:
|
|||
|
||||
};
|
||||
|
||||
inline const QList<Media::Tag *> &TagFieldEdit::tags() const
|
||||
inline const QList<TagParser::Tag *> &TagFieldEdit::tags() const
|
||||
{
|
||||
return *m_tags;
|
||||
}
|
||||
|
||||
inline Media::KnownField TagFieldEdit::field() const
|
||||
inline TagParser::KnownField TagFieldEdit::field() const
|
||||
{
|
||||
return m_field;
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
using namespace std;
|
||||
using namespace ConversionUtilities;
|
||||
using namespace ChronoUtilities;
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
using namespace Utility;
|
||||
|
||||
namespace HtmlInfo {
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
|
||||
#include <list>
|
||||
|
||||
namespace Media {
|
||||
namespace TagParser {
|
||||
class MediaFileInfo;
|
||||
class Diagnostics;
|
||||
}
|
||||
|
||||
namespace HtmlInfo {
|
||||
|
||||
QByteArray generateInfo(const Media::MediaFileInfo &file, Media::Diagnostics &diag, Media::Diagnostics &diagReparsing);
|
||||
QByteArray generateInfo(const TagParser::MediaFileInfo &file, TagParser::Diagnostics &diag, TagParser::Diagnostics &diagReparsing);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
|
||||
namespace Utility
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@ QT_FORWARD_DECLARE_CLASS(QDir)
|
|||
QT_FORWARD_DECLARE_CLASS(QAbstractItemModel)
|
||||
QT_FORWARD_DECLARE_CLASS(QModelIndex)
|
||||
|
||||
namespace Media {
|
||||
namespace TagParser {
|
||||
class MediaFileInfo;
|
||||
class Tag;
|
||||
enum class ElementPosition;
|
||||
|
@ -17,13 +17,13 @@ enum class ElementPosition;
|
|||
|
||||
namespace Utility {
|
||||
|
||||
const char *textEncodingToCodecName(Media::TagTextEncoding textEncoding);
|
||||
QString tagValueToQString(const Media::TagValue &value);
|
||||
QString dataToQString(const char *data, std::size_t dataSize, Media::TagTextEncoding encoding);
|
||||
QString stringToQString(const std::string &value, Media::TagTextEncoding textEncoding);
|
||||
std::string qstringToString(const QString &value, Media::TagTextEncoding textEncoding);
|
||||
Media::TagValue qstringToTagValue(const QString &value, Media::TagTextEncoding textEncoding);
|
||||
QString elementPositionToQString(Media::ElementPosition elementPosition);
|
||||
const char *textEncodingToCodecName(TagParser::TagTextEncoding textEncoding);
|
||||
QString tagValueToQString(const TagParser::TagValue &value);
|
||||
QString dataToQString(const char *data, std::size_t dataSize, TagParser::TagTextEncoding encoding);
|
||||
QString stringToQString(const std::string &value, TagParser::TagTextEncoding textEncoding);
|
||||
std::string qstringToString(const QString &value, TagParser::TagTextEncoding textEncoding);
|
||||
TagParser::TagValue qstringToTagValue(const QString &value, TagParser::TagTextEncoding textEncoding);
|
||||
QString elementPositionToQString(TagParser::ElementPosition elementPosition);
|
||||
QString formatName(const QString &str, bool underscoreToWhitespace = true);
|
||||
QString fixUmlauts(const QString &str);
|
||||
void parseFileName(const QString &fileName, QString &title, int &trackNumber);
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
using namespace ConversionUtilities;
|
||||
using namespace Utility;
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
using namespace std;
|
||||
|
||||
namespace RenamingUtility {
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace TestUtilities {
|
|||
/*!
|
||||
* \brief Prints a DiagMessage to enable using it in CPPUNIT_ASSERT_EQUAL.
|
||||
*/
|
||||
inline std::ostream &operator <<(std::ostream &os, const Media::DiagMessage &diagMessage)
|
||||
inline std::ostream &operator <<(std::ostream &os, const TagParser::DiagMessage &diagMessage)
|
||||
{
|
||||
return os << diagMessage.levelName() << ':' << ' ' << diagMessage.message() << ' ' << '(' << diagMessage.context() << ')';
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ using namespace std;
|
|||
using namespace TestUtilities;
|
||||
using namespace TestUtilities::Literals;
|
||||
using namespace ConversionUtilities;
|
||||
using namespace Media;
|
||||
using namespace TagParser;
|
||||
|
||||
using namespace CPPUNIT_NS;
|
||||
|
||||
|
|
Loading…
Reference in New Issue