Format all GUI-only files
This commit is contained in:
parent
4f53029a6e
commit
3ac822c5fe
|
@ -4,39 +4,37 @@
|
||||||
|
|
||||||
#include "resources/config.h"
|
#include "resources/config.h"
|
||||||
|
|
||||||
|
#include <tagparser/backuphelper.h>
|
||||||
#include <tagparser/mediafileinfo.h>
|
#include <tagparser/mediafileinfo.h>
|
||||||
#include <tagparser/tag.h>
|
#include <tagparser/tag.h>
|
||||||
#include <tagparser/backuphelper.h>
|
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QSettings>
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
using namespace TagParser;
|
using namespace TagParser;
|
||||||
|
|
||||||
namespace Settings {
|
namespace Settings {
|
||||||
|
|
||||||
AutoCompletition::AutoCompletition() :
|
AutoCompletition::AutoCompletition()
|
||||||
fields(nullptr, KnownFieldModel::DefaultSelection::None)
|
: fields(nullptr, KnownFieldModel::DefaultSelection::None)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Editor::Editor() :
|
Editor::Editor()
|
||||||
fields(nullptr, KnownFieldModel::DefaultSelection::CommonFields),
|
: fields(nullptr, KnownFieldModel::DefaultSelection::CommonFields)
|
||||||
defaultTargets(nullptr, TargetLevelModel::DefaultSelection::MostUsefulTargets)
|
, defaultTargets(nullptr, TargetLevelModel::DefaultSelection::MostUsefulTargets)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
DbQuery::DbQuery() :
|
DbQuery::DbQuery()
|
||||||
fields(QList<Models::ChecklistItem>()
|
: fields(QList<Models::ChecklistItem>() << KnownFieldModel::mkItem(KnownField::Title) << KnownFieldModel::mkItem(KnownField::TrackPosition)
|
||||||
<< KnownFieldModel::mkItem(KnownField::Title)
|
<< KnownFieldModel::mkItem(KnownField::DiskPosition) << KnownFieldModel::mkItem(KnownField::Album)
|
||||||
<< KnownFieldModel::mkItem(KnownField::TrackPosition)
|
<< KnownFieldModel::mkItem(KnownField::Album) << KnownFieldModel::mkItem(KnownField::Year)
|
||||||
<< KnownFieldModel::mkItem(KnownField::DiskPosition)
|
<< KnownFieldModel::mkItem(KnownField::Genre) << KnownFieldModel::mkItem(KnownField::Cover, Qt::Unchecked)
|
||||||
<< KnownFieldModel::mkItem(KnownField::Album)
|
|
||||||
<< KnownFieldModel::mkItem(KnownField::Album)
|
|
||||||
<< KnownFieldModel::mkItem(KnownField::Year)
|
|
||||||
<< KnownFieldModel::mkItem(KnownField::Genre)
|
|
||||||
<< KnownFieldModel::mkItem(KnownField::Cover, Qt::Unchecked)
|
|
||||||
<< KnownFieldModel::mkItem(KnownField::Lyrics, Qt::Unchecked))
|
<< KnownFieldModel::mkItem(KnownField::Lyrics, Qt::Unchecked))
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Settings &values()
|
Settings &values()
|
||||||
{
|
{
|
||||||
|
@ -48,7 +46,8 @@ void restore()
|
||||||
{
|
{
|
||||||
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QStringLiteral(PROJECT_NAME));
|
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QStringLiteral(PROJECT_NAME));
|
||||||
// move old config to new location
|
// move old config to new location
|
||||||
const QString oldConfig = QSettings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(), QApplication::applicationName()).fileName();
|
const QString oldConfig
|
||||||
|
= QSettings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(), QApplication::applicationName()).fileName();
|
||||||
QFile::rename(oldConfig, settings.fileName()) || QFile::remove(oldConfig);
|
QFile::rename(oldConfig, settings.fileName()) || QFile::remove(oldConfig);
|
||||||
settings.sync();
|
settings.sync();
|
||||||
Settings &v = values();
|
Settings &v = values();
|
||||||
|
@ -126,30 +125,35 @@ void restore()
|
||||||
settings.beginGroup(QStringLiteral("id3v1"));
|
settings.beginGroup(QStringLiteral("id3v1"));
|
||||||
switch (settings.value(QStringLiteral("usage"), 0).toInt()) {
|
switch (settings.value(QStringLiteral("usage"), 0).toInt()) {
|
||||||
case 1:
|
case 1:
|
||||||
v.tagPocessing.id3.v1Usage = TagUsage::KeepExisting;
|
v.tagPocessing.creationSettings.id3v1usage = TagUsage::KeepExisting;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
v.tagPocessing.id3.v1Usage = TagUsage::Never;
|
v.tagPocessing.creationSettings.id3v1usage = TagUsage::Never;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
v.tagPocessing.id3.v1Usage = TagUsage::Always;
|
v.tagPocessing.creationSettings.id3v1usage = TagUsage::Always;
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
settings.beginGroup(QStringLiteral("id3v2"));
|
settings.beginGroup(QStringLiteral("id3v2"));
|
||||||
switch (settings.value(QStringLiteral("usage"), 0).toInt()) {
|
switch (settings.value(QStringLiteral("usage"), 0).toInt()) {
|
||||||
case 1:
|
case 1:
|
||||||
v.tagPocessing.id3.v2Usage = TagUsage::KeepExisting;
|
v.tagPocessing.creationSettings.id3v2usage = TagUsage::KeepExisting;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
v.tagPocessing.id3.v2Usage = TagUsage::Never;
|
v.tagPocessing.creationSettings.id3v2usage = TagUsage::Never;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
v.tagPocessing.id3.v2Usage = TagUsage::Always;
|
v.tagPocessing.creationSettings.id3v2usage = TagUsage::Always;
|
||||||
};
|
};
|
||||||
v.tagPocessing.id3.v2Version = settings.value(QStringLiteral("versiontobeused"), 3).toUInt();
|
v.tagPocessing.creationSettings.id3v2MajorVersion = static_cast<byte>(settings.value(QStringLiteral("versiontobeused")).toUInt());
|
||||||
v.tagPocessing.id3.keepVersionOfExistingId3v2Tag = settings.value(QStringLiteral("keepversionofexistingtag"), true).toBool();
|
if (v.tagPocessing.creationSettings.id3v2MajorVersion < 1 || v.tagPocessing.creationSettings.id3v2MajorVersion > 4) {
|
||||||
v.tagPocessing.id3.mergeMultipleSuccessiveId3v2Tags = settings.value(QStringLiteral("mergemultiplesuccessivetags"), true).toBool();
|
v.tagPocessing.creationSettings.id3v2MajorVersion = 3;
|
||||||
|
}
|
||||||
|
v.tagPocessing.creationSettings.setFlag(
|
||||||
|
TagCreationFlags::KeepExistingId3v2Version, settings.value(QStringLiteral("keepversionofexistingtag"), true).toBool());
|
||||||
|
v.tagPocessing.creationSettings.setFlag(
|
||||||
|
TagCreationFlags::MergeMultipleSuccessiveId3v2Tags, settings.value(QStringLiteral("mergemultiplesuccessivetags"), true).toBool());
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
v.editor.defaultTargets.restore(settings, QStringLiteral("targets"));
|
v.editor.defaultTargets.restore(settings, QStringLiteral("targets"));
|
||||||
settings.beginGroup(QStringLiteral("filelayout"));
|
settings.beginGroup(QStringLiteral("filelayout"));
|
||||||
|
@ -243,13 +247,14 @@ void save()
|
||||||
settings.setValue(QStringLiteral("unsupportedfieldhandling"), static_cast<int>(v.tagPocessing.unsupportedFieldHandling));
|
settings.setValue(QStringLiteral("unsupportedfieldhandling"), static_cast<int>(v.tagPocessing.unsupportedFieldHandling));
|
||||||
settings.setValue(QStringLiteral("autotagmanagement"), v.tagPocessing.autoTagManagement);
|
settings.setValue(QStringLiteral("autotagmanagement"), v.tagPocessing.autoTagManagement);
|
||||||
settings.beginGroup(QStringLiteral("id3v1"));
|
settings.beginGroup(QStringLiteral("id3v1"));
|
||||||
settings.setValue(QStringLiteral("usage"), static_cast<int>(v.tagPocessing.id3.v1Usage));
|
settings.setValue(QStringLiteral("usage"), static_cast<int>(v.tagPocessing.creationSettings.id3v1usage));
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
settings.beginGroup(QStringLiteral("id3v2"));
|
settings.beginGroup(QStringLiteral("id3v2"));
|
||||||
settings.setValue(QStringLiteral("usage"), static_cast<int>(v.tagPocessing.id3.v2Usage));
|
settings.setValue(QStringLiteral("usage"), static_cast<int>(v.tagPocessing.creationSettings.id3v2usage));
|
||||||
settings.setValue(QStringLiteral("versiontobeused"), v.tagPocessing.id3.v2Version);
|
settings.setValue(QStringLiteral("versiontobeused"), v.tagPocessing.creationSettings.id3v2MajorVersion);
|
||||||
settings.setValue(QStringLiteral("keepversionofexistingtag"), v.tagPocessing.id3.keepVersionOfExistingId3v2Tag);
|
settings.setValue(QStringLiteral("keepversionofexistingtag"), v.tagPocessing.creationSettings.flags & TagCreationFlags::KeepExistingId3v2Version);
|
||||||
settings.setValue(QStringLiteral("mergemultiplesuccessivetags"), v.tagPocessing.id3.mergeMultipleSuccessiveId3v2Tags);
|
settings.setValue(
|
||||||
|
QStringLiteral("mergemultiplesuccessivetags"), v.tagPocessing.creationSettings.flags & TagCreationFlags::MergeMultipleSuccessiveId3v2Tags);
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
v.editor.defaultTargets.save(settings, QStringLiteral("targets"));
|
v.editor.defaultTargets.save(settings, QStringLiteral("targets"));
|
||||||
settings.beginGroup(QStringLiteral("filelayout"));
|
settings.beginGroup(QStringLiteral("filelayout"));
|
||||||
|
@ -288,4 +293,4 @@ void save()
|
||||||
v.qt.save(settings);
|
v.qt.save(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace Settings
|
||||||
|
|
|
@ -1,45 +1,30 @@
|
||||||
#ifndef SETTINGS_H
|
#ifndef SETTINGS_H
|
||||||
#define SETTINGS_H
|
#define SETTINGS_H
|
||||||
|
|
||||||
#include "./targetlevelmodel.h"
|
|
||||||
#include "./knownfieldmodel.h"
|
#include "./knownfieldmodel.h"
|
||||||
|
#include "./targetlevelmodel.h"
|
||||||
|
|
||||||
#include <c++utilities/conversion/types.h>
|
#include <c++utilities/conversion/types.h>
|
||||||
|
|
||||||
#include <tagparser/abstractcontainer.h>
|
#include <tagparser/abstractcontainer.h>
|
||||||
#include <tagparser/tagvalue.h>
|
|
||||||
#include <tagparser/settings.h>
|
#include <tagparser/settings.h>
|
||||||
#include <tagparser/tag.h>
|
#include <tagparser/tag.h>
|
||||||
|
#include <tagparser/tagvalue.h>
|
||||||
|
|
||||||
#include <qtutilities/settingsdialog/qtsettings.h>
|
#include <qtutilities/settingsdialog/qtsettings.h>
|
||||||
|
|
||||||
#include <QString>
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
namespace Settings {
|
namespace Settings {
|
||||||
|
|
||||||
enum class ActionEnabled
|
enum class ActionEnabled { Ask, Yes, No };
|
||||||
{
|
|
||||||
Ask,
|
|
||||||
Yes,
|
|
||||||
No
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class AdoptFields
|
enum class AdoptFields { Never, WithinDirectory, Always };
|
||||||
{
|
|
||||||
Never,
|
|
||||||
WithinDirectory,
|
|
||||||
Always
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class MultipleTagHandling
|
enum class MultipleTagHandling { SingleEditorPerTarget, SeparateEditors };
|
||||||
{
|
|
||||||
SingleEditorPerTarget,
|
|
||||||
SeparateEditors
|
|
||||||
};
|
|
||||||
|
|
||||||
struct AutoCompletition
|
struct AutoCompletition {
|
||||||
{
|
|
||||||
AutoCompletition();
|
AutoCompletition();
|
||||||
bool insertTitleFromFilename = false;
|
bool insertTitleFromFilename = false;
|
||||||
bool trimWhitespaces = true;
|
bool trimWhitespaces = true;
|
||||||
|
@ -48,8 +33,7 @@ struct AutoCompletition
|
||||||
KnownFieldModel fields;
|
KnownFieldModel fields;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Editor
|
struct Editor {
|
||||||
{
|
|
||||||
Editor();
|
Editor();
|
||||||
AdoptFields adoptFields = AdoptFields::Never;
|
AdoptFields adoptFields = AdoptFields::Never;
|
||||||
bool saveAndShowNextOnEnter = false;
|
bool saveAndShowNextOnEnter = false;
|
||||||
|
@ -66,20 +50,14 @@ struct Editor
|
||||||
TargetLevelModel defaultTargets;
|
TargetLevelModel defaultTargets;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class UnsupportedFieldHandling
|
enum class UnsupportedFieldHandling { Ignore, Discard };
|
||||||
{
|
|
||||||
Ignore,
|
|
||||||
Discard
|
|
||||||
};
|
|
||||||
|
|
||||||
struct FileBrowser
|
struct FileBrowser {
|
||||||
{
|
|
||||||
bool hideBackupFiles = true;
|
bool hideBackupFiles = true;
|
||||||
bool readOnly = true;
|
bool readOnly = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FileLayout
|
struct FileLayout {
|
||||||
{
|
|
||||||
bool forceRewrite = true;
|
bool forceRewrite = true;
|
||||||
TagParser::ElementPosition preferredTagPosition = TagParser::ElementPosition::BeforeData;
|
TagParser::ElementPosition preferredTagPosition = TagParser::ElementPosition::BeforeData;
|
||||||
bool forceTagPosition = true;
|
bool forceTagPosition = true;
|
||||||
|
@ -90,8 +68,7 @@ struct FileLayout
|
||||||
std::size_t preferredPadding = 0;
|
std::size_t preferredPadding = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TagProcessing
|
struct TagProcessing {
|
||||||
{
|
|
||||||
TagParser::TagTextEncoding preferredEncoding = TagParser::TagTextEncoding::Utf8;
|
TagParser::TagTextEncoding preferredEncoding = TagParser::TagTextEncoding::Utf8;
|
||||||
UnsupportedFieldHandling unsupportedFieldHandling = UnsupportedFieldHandling::Ignore;
|
UnsupportedFieldHandling unsupportedFieldHandling = UnsupportedFieldHandling::Ignore;
|
||||||
bool autoTagManagement = true;
|
bool autoTagManagement = true;
|
||||||
|
@ -99,16 +76,14 @@ struct TagProcessing
|
||||||
FileLayout fileLayout;
|
FileLayout fileLayout;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MainWindow
|
struct MainWindow {
|
||||||
{
|
|
||||||
QByteArray geometry;
|
QByteArray geometry;
|
||||||
QByteArray state;
|
QByteArray state;
|
||||||
QString currentFileBrowserDirectory;
|
QString currentFileBrowserDirectory;
|
||||||
bool layoutLocked = false;
|
bool layoutLocked = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DbQuery
|
struct DbQuery {
|
||||||
{
|
|
||||||
DbQuery();
|
DbQuery();
|
||||||
bool widgetShown = false;
|
bool widgetShown = false;
|
||||||
bool override = false;
|
bool override = false;
|
||||||
|
@ -118,15 +93,13 @@ struct DbQuery
|
||||||
QString lyricsWikiaUrl;
|
QString lyricsWikiaUrl;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RenamingUtility
|
struct RenamingUtility {
|
||||||
{
|
|
||||||
int scriptSource = 0;
|
int scriptSource = 0;
|
||||||
QString externalScript;
|
QString externalScript;
|
||||||
QString editorScript;
|
QString editorScript;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Settings
|
struct Settings {
|
||||||
{
|
|
||||||
Editor editor;
|
Editor editor;
|
||||||
FileBrowser fileBrowser;
|
FileBrowser fileBrowser;
|
||||||
TagProcessing tagPocessing;
|
TagProcessing tagPocessing;
|
||||||
|
@ -140,6 +113,6 @@ Settings &values();
|
||||||
void restore();
|
void restore();
|
||||||
void save();
|
void save();
|
||||||
|
|
||||||
}
|
} // namespace Settings
|
||||||
|
|
||||||
#endif // SETTINGS_H
|
#endif // SETTINGS_H
|
||||||
|
|
|
@ -46,8 +46,8 @@ QString TargetLevelModel::labelForId(const QVariant &id) const
|
||||||
return translatedFieldName(static_cast<TagTargetLevel>(id.toInt()));
|
return translatedFieldName(static_cast<TagTargetLevel>(id.toInt()));
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetLevelModel::TargetLevelModel(QObject *parent, DefaultSelection defaultSelection) :
|
TargetLevelModel::TargetLevelModel(QObject *parent, DefaultSelection defaultSelection)
|
||||||
ChecklistModel(parent)
|
: ChecklistModel(parent)
|
||||||
{
|
{
|
||||||
QList<ChecklistItem> items;
|
QList<ChecklistItem> items;
|
||||||
items.reserve(8);
|
items.reserve(8);
|
||||||
|
@ -63,8 +63,8 @@ TargetLevelModel::TargetLevelModel(QObject *parent, DefaultSelection defaultSele
|
||||||
setItems(items);
|
setItems(items);
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetLevelModel::TargetLevelModel(const QList<Models::ChecklistItem> &items, QObject *parent) :
|
TargetLevelModel::TargetLevelModel(const QList<Models::ChecklistItem> &items, QObject *parent)
|
||||||
ChecklistModel(parent)
|
: ChecklistModel(parent)
|
||||||
{
|
{
|
||||||
setItems(items);
|
setItems(items);
|
||||||
}
|
}
|
||||||
|
@ -78,15 +78,13 @@ QVariant TargetLevelModel::headerData(int section, Qt::Orientation orientation,
|
||||||
switch (section) {
|
switch (section) {
|
||||||
case 0:
|
case 0:
|
||||||
return tr("Target level");
|
return tr("Target level");
|
||||||
default:
|
default:;
|
||||||
;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:;
|
||||||
;
|
|
||||||
}
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace Settings
|
||||||
|
|
|
@ -12,15 +12,10 @@ DECLARE_ENUM_CLASS(TagTargetLevel, unsigned char);
|
||||||
|
|
||||||
namespace Settings {
|
namespace Settings {
|
||||||
|
|
||||||
class TargetLevelModel : public Models::ChecklistModel
|
class TargetLevelModel : public Models::ChecklistModel {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
enum class DefaultSelection
|
enum class DefaultSelection { None, MostUsefulTargets };
|
||||||
{
|
|
||||||
None,
|
|
||||||
MostUsefulTargets
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char *fieldName(TagParser::TagTargetLevel targetLevel);
|
static const char *fieldName(TagParser::TagTargetLevel targetLevel);
|
||||||
static QString translatedFieldName(TagParser::TagTargetLevel targetLevel);
|
static QString translatedFieldName(TagParser::TagTargetLevel targetLevel);
|
||||||
|
@ -38,6 +33,6 @@ inline Models::ChecklistItem TargetLevelModel::mkItem(TagParser::TagTargetLevel
|
||||||
return Models::ChecklistItem(static_cast<int>(field), translatedFieldName(field), checkState);
|
return Models::ChecklistItem(static_cast<int>(field), translatedFieldName(field), checkState);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace Settings
|
||||||
|
|
||||||
#endif // TARGETLEVELMODEL_H
|
#endif // TARGETLEVELMODEL_H
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
#include "./htmlinfo.h"
|
#include "./htmlinfo.h"
|
||||||
#include "./utility.h"
|
#include "./utility.h"
|
||||||
|
|
||||||
#include <tagparser/signature.h>
|
#include <tagparser/abstractattachment.h>
|
||||||
#include <tagparser/mediafileinfo.h>
|
|
||||||
#include <tagparser/abstractcontainer.h>
|
#include <tagparser/abstractcontainer.h>
|
||||||
|
#include <tagparser/abstracttrack.h>
|
||||||
#include <tagparser/matroska/matroskacontainer.h>
|
#include <tagparser/matroska/matroskacontainer.h>
|
||||||
#include <tagparser/matroska/matroskaeditionentry.h>
|
#include <tagparser/matroska/matroskaeditionentry.h>
|
||||||
|
#include <tagparser/mediafileinfo.h>
|
||||||
#include <tagparser/mp4/mp4container.h>
|
#include <tagparser/mp4/mp4container.h>
|
||||||
#include <tagparser/abstracttrack.h>
|
#include <tagparser/signature.h>
|
||||||
#include <tagparser/abstractattachment.h>
|
|
||||||
|
|
||||||
#include <qtutilities/resources/resources.h>
|
#include <qtutilities/resources/resources.h>
|
||||||
|
|
||||||
#include <c++utilities/chrono/timespan.h>
|
|
||||||
#include <c++utilities/chrono/datetime.h>
|
#include <c++utilities/chrono/datetime.h>
|
||||||
|
#include <c++utilities/chrono/timespan.h>
|
||||||
#include <c++utilities/conversion/stringconversion.h>
|
#include <c++utilities/conversion/stringconversion.h>
|
||||||
|
|
||||||
#if defined(TAGEDITOR_GUI_QTWIDGETS)
|
#if defined(TAGEDITOR_GUI_QTWIDGETS)
|
||||||
|
@ -27,11 +27,11 @@
|
||||||
#include <QFontMetrics>
|
#include <QFontMetrics>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#endif
|
#endif
|
||||||
#include <QString>
|
|
||||||
#include <QStringBuilder>
|
|
||||||
#include <QResource>
|
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
|
#include <QResource>
|
||||||
|
#include <QString>
|
||||||
|
#include <QStringBuilder>
|
||||||
#include <QXmlStreamWriter>
|
#include <QXmlStreamWriter>
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
@ -47,8 +47,7 @@
|
||||||
res.append(fallback); \
|
res.append(fallback); \
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
# define APPEND_GUI_RULE(rule, fallback) \
|
#define APPEND_GUI_RULE(rule, fallback) res.append(fallback);
|
||||||
res.append(fallback);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -69,13 +68,13 @@ inline QString qstr(const string &stdstr)
|
||||||
return QString::fromUtf8(stdstr.data(), static_cast<int>(stdstr.size()));
|
return QString::fromUtf8(stdstr.data(), static_cast<int>(stdstr.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
class RowMaker
|
class RowMaker {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
RowMaker(QXmlStreamWriter &writer) :
|
RowMaker(QXmlStreamWriter &writer)
|
||||||
writer(writer),
|
: writer(writer)
|
||||||
m_even(true)
|
, m_even(true)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
|
@ -232,8 +231,8 @@ QString mkFontStyle(const QFont &font)
|
||||||
return QStringLiteral("font-family: \"%1\", sans-serif;"
|
return QStringLiteral("font-family: \"%1\", sans-serif;"
|
||||||
"font-style: %2;"
|
"font-style: %2;"
|
||||||
"font-weight: %3;"
|
"font-weight: %3;"
|
||||||
"font-size: %4;").arg(
|
"font-size: %4;")
|
||||||
font.family(), style, weight, size);
|
.arg(font.family(), style, weight, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray mkBase64(const QIcon &icon)
|
QByteArray mkBase64(const QIcon &icon)
|
||||||
|
@ -270,7 +269,8 @@ const QByteArray &mkDebugIconData()
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ElementType> void mkElementContent(QXmlStreamWriter &, ElementType *)
|
template <class ElementType> void mkElementContent(QXmlStreamWriter &, ElementType *)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
template <> void mkElementContent(QXmlStreamWriter &writer, EbmlElement *element)
|
template <> void mkElementContent(QXmlStreamWriter &writer, EbmlElement *element)
|
||||||
{
|
{
|
||||||
|
@ -288,7 +288,8 @@ template<> void mkElementContent(QXmlStreamWriter &writer, EbmlElement *element)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} case MatroskaIds::SeekPosition: {
|
}
|
||||||
|
case MatroskaIds::SeekPosition: {
|
||||||
writer.writeCharacters(QStringLiteral(", denoted position: "));
|
writer.writeCharacters(QStringLiteral(", denoted position: "));
|
||||||
const uint64 seekPos = element->readUInteger();
|
const uint64 seekPos = element->readUInteger();
|
||||||
const auto seekPosStr = QString::number(seekPos);
|
const auto seekPosStr = QString::number(seekPos);
|
||||||
|
@ -299,22 +300,21 @@ template<> void mkElementContent(QXmlStreamWriter &writer, EbmlElement *element)
|
||||||
writer.writeCharacters(seekPosStr);
|
writer.writeCharacters(seekPosStr);
|
||||||
writer.writeEndElement();
|
writer.writeEndElement();
|
||||||
break;
|
break;
|
||||||
} default:
|
}
|
||||||
;
|
default:;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Generator
|
class Generator {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
Generator(const MediaFileInfo &file, Diagnostics &diag, Diagnostics &diagReparsing)
|
||||||
Generator(const MediaFileInfo &file, Diagnostics &diag, Diagnostics &diagReparsing) :
|
: m_writer(&m_res)
|
||||||
m_writer(&m_res),
|
, m_rowMaker(m_writer)
|
||||||
m_rowMaker(m_writer),
|
, m_file(file)
|
||||||
m_file(file),
|
, m_diag(diag)
|
||||||
m_diag(diag),
|
, m_diagReparsing(diagReparsing)
|
||||||
m_diagReparsing(diagReparsing)
|
{
|
||||||
{}
|
}
|
||||||
|
|
||||||
QString mkStyle()
|
QString mkStyle()
|
||||||
{
|
{
|
||||||
|
@ -338,22 +338,25 @@ public:
|
||||||
#endif
|
#endif
|
||||||
res.append(QStringLiteral("}"
|
res.append(QStringLiteral("}"
|
||||||
"a:link, #structure .parent-node {"));
|
"a:link, #structure .parent-node {"));
|
||||||
APPEND_GUI_RULE(QStringLiteral("color: %1;").arg(palette.color(QPalette::Link).name()),
|
APPEND_GUI_RULE(QStringLiteral("color: %1;").arg(palette.color(QPalette::Link).name()), QStringLiteral("color: #337AB7;"))
|
||||||
QStringLiteral("color: #337AB7;"))
|
|
||||||
res.append(QStringLiteral("text-decoration: none;"
|
res.append(QStringLiteral("text-decoration: none;"
|
||||||
"}"
|
"}"
|
||||||
"a:focus, a:hover {"));
|
"a:focus, a:hover {"));
|
||||||
APPEND_GUI_RULE(QStringLiteral("color: %1;").arg(palette.link().color().darker(palette.color(QPalette::Background).lightness() > palette.color(QPalette::Link).lightness() ? 150 : 50).name()),
|
APPEND_GUI_RULE(QStringLiteral("color: %1;")
|
||||||
|
.arg(palette.link()
|
||||||
|
.color()
|
||||||
|
.darker(palette.color(QPalette::Background).lightness() > palette.color(QPalette::Link).lightness() ? 150 : 50)
|
||||||
|
.name()),
|
||||||
QStringLiteral("color: #23527c;"))
|
QStringLiteral("color: #23527c;"))
|
||||||
res.append(QStringLiteral("text-decoration: underline;"
|
res.append(QStringLiteral("text-decoration: underline;"
|
||||||
"} table {"
|
"} table {"
|
||||||
"border-collapse: collapse;"
|
"border-collapse: collapse;"
|
||||||
"width: 100%;"
|
"width: 100%;"
|
||||||
"} tr {"));
|
"} tr {"));
|
||||||
APPEND_GUI_RULE(QStringLiteral("background-color: %1;").arg(palette.color(QPalette::Base).name()),
|
APPEND_GUI_RULE(QStringLiteral("background-color: %1;").arg(palette.color(QPalette::Base).name()), QStringLiteral("background-color: #fff;"))
|
||||||
QStringLiteral("background-color: #fff;"))
|
|
||||||
res.append(QStringLiteral("} tr.even {"));
|
res.append(QStringLiteral("} tr.even {"));
|
||||||
APPEND_GUI_RULE(QStringLiteral("background-color: %1!important;").arg(palette.color(QPalette::AlternateBase).name()), QStringLiteral("background-color: #fafafa!important;"))
|
APPEND_GUI_RULE(QStringLiteral("background-color: %1!important;").arg(palette.color(QPalette::AlternateBase).name()),
|
||||||
|
QStringLiteral("background-color: #fafafa!important;"))
|
||||||
res.append(QStringLiteral("}"
|
res.append(QStringLiteral("}"
|
||||||
"table.headervertical th, table.headervertical td {"
|
"table.headervertical th, table.headervertical td {"
|
||||||
"padding: 2px 5px;"
|
"padding: 2px 5px;"
|
||||||
|
@ -518,42 +521,54 @@ public:
|
||||||
RowMaker rowMaker(m_writer);
|
RowMaker rowMaker(m_writer);
|
||||||
rowMaker.startSubTab(QCoreApplication::translate("HtmlInfo", "Track"), trackNumber);
|
rowMaker.startSubTab(QCoreApplication::translate("HtmlInfo", "Track"), trackNumber);
|
||||||
if (track->id()) {
|
if (track->id()) {
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "ID"), QCoreApplication::translate("HtmlInfo", "The unique number used to identify the track in the container file."), QString::number(track->id()));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "ID"),
|
||||||
|
QCoreApplication::translate("HtmlInfo", "The unique number used to identify the track in the container file."),
|
||||||
|
QString::number(track->id()));
|
||||||
}
|
}
|
||||||
if (track->trackNumber()) {
|
if (track->trackNumber()) {
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Number"), QCoreApplication::translate("HtmlInfo", "The index of the track in the container file."), QString::number(track->trackNumber()));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Number"),
|
||||||
|
QCoreApplication::translate("HtmlInfo", "The index of the track in the container file."), QString::number(track->trackNumber()));
|
||||||
}
|
}
|
||||||
if (!track->name().empty()) {
|
if (!track->name().empty()) {
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Name"), qstr(track->name()));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Name"), qstr(track->name()));
|
||||||
}
|
}
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Type"), qstr(track->mediaTypeName()));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Type"), qstr(track->mediaTypeName()));
|
||||||
const char *fmtName = track->formatName(), *fmtAbbr = track->formatAbbreviation();
|
const char *fmtName = track->formatName(), *fmtAbbr = track->formatAbbreviation();
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Format"), QCoreApplication::translate("HtmlInfo", "The unabbreviated name of the track's format."), qstr(fmtName));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Format"),
|
||||||
|
QCoreApplication::translate("HtmlInfo", "The unabbreviated name of the track's format."), qstr(fmtName));
|
||||||
if (track->format() != GeneralMediaFormat::Unknown && strcmp(fmtName, fmtAbbr)) { // format name and abbreviation differ
|
if (track->format() != GeneralMediaFormat::Unknown && strcmp(fmtName, fmtAbbr)) { // format name and abbreviation differ
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Abbreviation"), QCoreApplication::translate("HtmlInfo", "The abbreviated name of the track's format."), qstr(fmtAbbr));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Abbreviation"),
|
||||||
|
QCoreApplication::translate("HtmlInfo", "The abbreviated name of the track's format."), qstr(fmtAbbr));
|
||||||
}
|
}
|
||||||
if (track->version() != 0.0) {
|
if (track->version() != 0.0) {
|
||||||
switch (track->format().general) {
|
switch (track->format().general) {
|
||||||
case GeneralMediaFormat::Mpeg4Video:
|
case GeneralMediaFormat::Mpeg4Video:
|
||||||
case GeneralMediaFormat::Avc:
|
case GeneralMediaFormat::Avc:
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Level"), QCoreApplication::translate("HtmlInfo", "The version/level of the track's format."), QChar('L') + QString::number(track->version()));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Level"),
|
||||||
|
QCoreApplication::translate("HtmlInfo", "The version/level of the track's format."),
|
||||||
|
QChar('L') + QString::number(track->version()));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Version"), QCoreApplication::translate("HtmlInfo", "The version/level of the track's format."), QString::number(track->version()));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Version"),
|
||||||
|
QCoreApplication::translate("HtmlInfo", "The version/level of the track's format."), QString::number(track->version()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmtName = track->format().extensionName();
|
fmtName = track->format().extensionName();
|
||||||
if (*fmtName) {
|
if (*fmtName) {
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Extension"), QCoreApplication::translate("HtmlInfo", "Used format extensions."), qstr(fmtName));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Extension"), QCoreApplication::translate("HtmlInfo", "Used format extensions."),
|
||||||
|
qstr(fmtName));
|
||||||
}
|
}
|
||||||
if (!track->formatId().empty()) {
|
if (!track->formatId().empty()) {
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Format/codec ID"), QCoreApplication::translate("HtmlInfo", "The raw format/codec identifier extracted from the container."), qstr(track->formatId()));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Format/codec ID"),
|
||||||
|
QCoreApplication::translate("HtmlInfo", "The raw format/codec identifier extracted from the container."), qstr(track->formatId()));
|
||||||
}
|
}
|
||||||
if (track->size()) {
|
if (track->size()) {
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Size"), qstr(dataSizeToString(track->size(), true)));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Size"), qstr(dataSizeToString(track->size(), true)));
|
||||||
}
|
}
|
||||||
if (!track->duration().isNull()) {
|
if (!track->duration().isNull()) {
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Duration"), qstr(track->duration().toString(TimeSpanOutputFormat::WithMeasures)) % QStringLiteral(" (") % QString::number(track->duration().totalTicks()) % QChar(')'));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Duration"),
|
||||||
|
qstr(track->duration().toString(TimeSpanOutputFormat::WithMeasures)) % QStringLiteral(" (")
|
||||||
|
% QString::number(track->duration().totalTicks()) % QChar(')'));
|
||||||
}
|
}
|
||||||
if (track->bitrate() != 0.0) {
|
if (track->bitrate() != 0.0) {
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Avg. bitrate"), qstr(bitrateToString(track->bitrate())));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Avg. bitrate"), qstr(bitrateToString(track->bitrate())));
|
||||||
|
@ -562,10 +577,12 @@ public:
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Maximum bitrate"), qstr(bitrateToString(track->maxBitrate())));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Maximum bitrate"), qstr(bitrateToString(track->maxBitrate())));
|
||||||
}
|
}
|
||||||
if (!track->creationTime().isNull()) {
|
if (!track->creationTime().isNull()) {
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Creation time"), qstr(track->creationTime().toString(DateTimeOutputFormat::DateAndTime, true)));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Creation time"),
|
||||||
|
qstr(track->creationTime().toString(DateTimeOutputFormat::DateAndTime, true)));
|
||||||
}
|
}
|
||||||
if (!track->modificationTime().isNull()) {
|
if (!track->modificationTime().isNull()) {
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Modification time"), qstr(track->modificationTime().toString(DateTimeOutputFormat::DateAndTime, true)));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Modification time"),
|
||||||
|
qstr(track->modificationTime().toString(DateTimeOutputFormat::DateAndTime, true)));
|
||||||
}
|
}
|
||||||
if (!track->language().empty()) {
|
if (!track->language().empty()) {
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Language"), qstr(track->language()));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Language"), qstr(track->language()));
|
||||||
|
@ -575,14 +592,16 @@ public:
|
||||||
}
|
}
|
||||||
if (track->samplingFrequency()) {
|
if (track->samplingFrequency()) {
|
||||||
if (track->extensionSamplingFrequency()) {
|
if (track->extensionSamplingFrequency()) {
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Sampling frequency"), QString::number(track->extensionSamplingFrequency()) % QStringLiteral(" Hz / ") % QString::number(track->samplingFrequency()) % QStringLiteral(" Hz"));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Sampling frequency"),
|
||||||
|
QString::number(track->extensionSamplingFrequency()) % QStringLiteral(" Hz / ") % QString::number(track->samplingFrequency())
|
||||||
|
% QStringLiteral(" Hz"));
|
||||||
} else {
|
} else {
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Sampling frequency"), QString::number(track->samplingFrequency()) + QStringLiteral(" Hz"));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Sampling frequency"),
|
||||||
|
QString::number(track->samplingFrequency()) + QStringLiteral(" Hz"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (track->sampleCount()) {
|
if (track->sampleCount()) {
|
||||||
rowMaker.mkRow(track->mediaType() == MediaType::Video
|
rowMaker.mkRow(track->mediaType() == MediaType::Video ? QCoreApplication::translate("HtmlInfo", "Frame count")
|
||||||
? QCoreApplication::translate("HtmlInfo", "Frame count")
|
|
||||||
: QCoreApplication::translate("HtmlInfo", "Sample count"),
|
: QCoreApplication::translate("HtmlInfo", "Sample count"),
|
||||||
QString::number(track->sampleCount()));
|
QString::number(track->sampleCount()));
|
||||||
}
|
}
|
||||||
|
@ -599,7 +618,9 @@ public:
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Display size"), qstr(track->displaySize().toString()));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Display size"), qstr(track->displaySize().toString()));
|
||||||
}
|
}
|
||||||
if (track->pixelAspectRatio().isValid()) {
|
if (track->pixelAspectRatio().isValid()) {
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Pixel Aspect Ratio"), QString::number(track->pixelAspectRatio().numerator) % QStringLiteral(" : ") % QString::number(track->pixelAspectRatio().denominator));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Pixel Aspect Ratio"),
|
||||||
|
QString::number(track->pixelAspectRatio().numerator) % QStringLiteral(" : ")
|
||||||
|
% QString::number(track->pixelAspectRatio().denominator));
|
||||||
}
|
}
|
||||||
if (!track->cropping().isNull()) {
|
if (!track->cropping().isNull()) {
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Cropping"), qstr(track->cropping().toString()));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Cropping"), qstr(track->cropping().toString()));
|
||||||
|
@ -609,9 +630,13 @@ public:
|
||||||
}
|
}
|
||||||
if (track->channelConfigString()) {
|
if (track->channelConfigString()) {
|
||||||
if (track->extensionChannelConfigString()) {
|
if (track->extensionChannelConfigString()) {
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Channel config"), QCoreApplication::translate("HtmlInfo", "Channel configuration"), QStringLiteral("%1 / %2").arg(QString::fromUtf8(track->extensionChannelConfigString()), QString::fromUtf8(track->channelConfigString())));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Channel config"),
|
||||||
|
QCoreApplication::translate("HtmlInfo", "Channel configuration"),
|
||||||
|
QStringLiteral("%1 / %2").arg(
|
||||||
|
QString::fromUtf8(track->extensionChannelConfigString()), QString::fromUtf8(track->channelConfigString())));
|
||||||
} else {
|
} else {
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Channel config"), QCoreApplication::translate("HtmlInfo", "Channel configuration"), QString::fromUtf8(track->channelConfigString()));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Channel config"),
|
||||||
|
QCoreApplication::translate("HtmlInfo", "Channel configuration"), QString::fromUtf8(track->channelConfigString()));
|
||||||
}
|
}
|
||||||
} else if (track->channelCount()) {
|
} else if (track->channelCount()) {
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Channel count"), QString::number(track->channelCount()));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Channel count"), QString::number(track->channelCount()));
|
||||||
|
@ -661,7 +686,8 @@ public:
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Name"), qstr(attachment->name()));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Name"), qstr(attachment->name()));
|
||||||
}
|
}
|
||||||
if (attachment->data()) {
|
if (attachment->data()) {
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Size"), qstr(dataSizeToString(static_cast<uint64>(attachment->data()->size()), true)));
|
rowMaker.mkRow(
|
||||||
|
QCoreApplication::translate("HtmlInfo", "Size"), qstr(dataSizeToString(static_cast<uint64>(attachment->data()->size()), true)));
|
||||||
}
|
}
|
||||||
if (!attachment->mimeType().empty()) {
|
if (!attachment->mimeType().empty()) {
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Mime-type"), qstr(attachment->mimeType()));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Mime-type"), qstr(attachment->mimeType()));
|
||||||
|
@ -681,11 +707,13 @@ public:
|
||||||
}
|
}
|
||||||
for (const LocaleAwareString &name : chapter.names()) {
|
for (const LocaleAwareString &name : chapter.names()) {
|
||||||
static const string delim(", ");
|
static const string delim(", ");
|
||||||
const string locale = joinStrings(initializer_list<string>{joinStrings(name.languages(), delim, true), joinStrings(name.countries(), delim, true)}, delim, true);
|
const string locale = joinStrings(
|
||||||
|
initializer_list<string>{ joinStrings(name.languages(), delim, true), joinStrings(name.countries(), delim, true) }, delim, true);
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Name (%1)").arg(qstr(locale)), qstr(name));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Name (%1)").arg(qstr(locale)), qstr(name));
|
||||||
}
|
}
|
||||||
if (!chapter.startTime().isNegative()) {
|
if (!chapter.startTime().isNegative()) {
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Start time"), qstr(chapter.startTime().toString(TimeSpanOutputFormat::WithMeasures)));
|
rowMaker.mkRow(
|
||||||
|
QCoreApplication::translate("HtmlInfo", "Start time"), qstr(chapter.startTime().toString(TimeSpanOutputFormat::WithMeasures)));
|
||||||
}
|
}
|
||||||
if (!chapter.endTime().isNegative()) {
|
if (!chapter.endTime().isNegative()) {
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "End time"), qstr(chapter.endTime().toString(TimeSpanOutputFormat::WithMeasures)));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "End time"), qstr(chapter.endTime().toString(TimeSpanOutputFormat::WithMeasures)));
|
||||||
|
@ -735,7 +763,8 @@ public:
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Labeled as"), labels.join(QStringLiteral(", ")));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Labeled as"), labels.join(QStringLiteral(", ")));
|
||||||
}
|
}
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Chapters"),
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Chapters"),
|
||||||
QCoreApplication::translate("HtmlInfo", "edition contains %1 chapter(s)", nullptr, static_cast<int>(edition.chapters().size())).arg(edition.chapters().size()));
|
QCoreApplication::translate("HtmlInfo", "edition contains %1 chapter(s)", nullptr, static_cast<int>(edition.chapters().size()))
|
||||||
|
.arg(edition.chapters().size()));
|
||||||
rowMaker.endSubTab();
|
rowMaker.endSubTab();
|
||||||
unsigned int chapterNumber = 0;
|
unsigned int chapterNumber = 0;
|
||||||
for (const auto &chapter : edition.chapters()) {
|
for (const auto &chapter : edition.chapters()) {
|
||||||
|
@ -747,7 +776,8 @@ public:
|
||||||
template <class ElementType, bool isAdditional = false> void mkElementNode(ElementType *element)
|
template <class ElementType, bool isAdditional = false> void mkElementNode(ElementType *element)
|
||||||
{
|
{
|
||||||
m_writer.writeStartElement(QStringLiteral("ul"));
|
m_writer.writeStartElement(QStringLiteral("ul"));
|
||||||
m_writer.writeAttribute(QStringLiteral("class"), element && element->parent() ? QStringLiteral("nodecollapsed") : QStringLiteral("nodeexpanded"));
|
m_writer.writeAttribute(
|
||||||
|
QStringLiteral("class"), element && element->parent() ? QStringLiteral("nodecollapsed") : QStringLiteral("nodeexpanded"));
|
||||||
while (element) {
|
while (element) {
|
||||||
if (element->isParsed()) {
|
if (element->isParsed()) {
|
||||||
m_writer.writeStartElement(QStringLiteral("li"));
|
m_writer.writeStartElement(QStringLiteral("li"));
|
||||||
|
@ -816,15 +846,19 @@ public:
|
||||||
}
|
}
|
||||||
startTableSection();
|
startTableSection();
|
||||||
const QString moreId(reparsing ? QStringLiteral("notificationsReparsingMore") : QStringLiteral("notificationsMore"));
|
const QString moreId(reparsing ? QStringLiteral("notificationsReparsingMore") : QStringLiteral("notificationsMore"));
|
||||||
m_rowMaker.startRow(reparsing ? QCoreApplication::translate("HtmlInfo", "Notifications (reparsing after saving)") : QCoreApplication::translate("HtmlInfo", "Notifications"));
|
m_rowMaker.startRow(reparsing ? QCoreApplication::translate("HtmlInfo", "Notifications (reparsing after saving)")
|
||||||
m_writer.writeCharacters(QCoreApplication::translate("HtmlInfo", "%1 notification(s) available", nullptr, trQuandity(diag.size())).arg(diag.size()));
|
: QCoreApplication::translate("HtmlInfo", "Notifications"));
|
||||||
|
m_writer.writeCharacters(
|
||||||
|
QCoreApplication::translate("HtmlInfo", "%1 notification(s) available", nullptr, trQuandity(diag.size())).arg(diag.size()));
|
||||||
mkSpace();
|
mkSpace();
|
||||||
mkDetailsLink(moreId, QCoreApplication::translate("HtmlInfo", "show notifications"));
|
mkDetailsLink(moreId, QCoreApplication::translate("HtmlInfo", "show notifications"));
|
||||||
m_rowMaker.endRow();
|
m_rowMaker.endRow();
|
||||||
m_writer.writeEndElement();
|
m_writer.writeEndElement();
|
||||||
|
|
||||||
startExtendedTableSection(moreId);
|
startExtendedTableSection(moreId);
|
||||||
m_rowMaker.startHorizontalSubTab(QString(), QStringList({QString(), QCoreApplication::translate("HtmlInfo", "Context"), QCoreApplication::translate("HtmlInfo", "Message"), QCoreApplication::translate("HtmlInfo", "Time")}));
|
m_rowMaker.startHorizontalSubTab(QString(),
|
||||||
|
QStringList({ QString(), QCoreApplication::translate("HtmlInfo", "Context"), QCoreApplication::translate("HtmlInfo", "Message"),
|
||||||
|
QCoreApplication::translate("HtmlInfo", "Time") }));
|
||||||
for (const auto &msg : diag) {
|
for (const auto &msg : diag) {
|
||||||
m_writer.writeStartElement(QStringLiteral("tr"));
|
m_writer.writeStartElement(QStringLiteral("tr"));
|
||||||
m_writer.writeEmptyElement(QStringLiteral("td"));
|
m_writer.writeEmptyElement(QStringLiteral("td"));
|
||||||
|
@ -845,7 +879,8 @@ public:
|
||||||
#endif
|
#endif
|
||||||
// <!DOCTYPE ... <html> <head>
|
// <!DOCTYPE ... <html> <head>
|
||||||
m_writer.writeStartDocument();
|
m_writer.writeStartDocument();
|
||||||
m_writer.writeDTD(QStringLiteral("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"));
|
m_writer.writeDTD(
|
||||||
|
QStringLiteral("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"));
|
||||||
m_writer.writeStartElement(QStringLiteral("html"));
|
m_writer.writeStartElement(QStringLiteral("html"));
|
||||||
m_writer.writeAttribute(QStringLiteral("xmlns"), QStringLiteral("http://www.w3.org/1999/xhtml"));
|
m_writer.writeAttribute(QStringLiteral("xmlns"), QStringLiteral("http://www.w3.org/1999/xhtml"));
|
||||||
m_writer.writeStartElement(QStringLiteral("head"));
|
m_writer.writeStartElement(QStringLiteral("head"));
|
||||||
|
@ -879,7 +914,8 @@ public:
|
||||||
const TimeSpan duration = m_file.duration();
|
const TimeSpan duration = m_file.duration();
|
||||||
if (!duration.isNull()) {
|
if (!duration.isNull()) {
|
||||||
m_rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Duration"), qstr(duration.toString(TimeSpanOutputFormat::WithMeasures)));
|
m_rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Duration"), qstr(duration.toString(TimeSpanOutputFormat::WithMeasures)));
|
||||||
m_rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Overall avg. bitrate"), qstr(bitrateToString(0.0078125 * m_file.size() / duration.totalSeconds())));
|
m_rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Overall avg. bitrate"),
|
||||||
|
qstr(bitrateToString(0.0078125 * m_file.size() / duration.totalSeconds())));
|
||||||
}
|
}
|
||||||
const char *const mimeType = m_file.mimeType();
|
const char *const mimeType = m_file.mimeType();
|
||||||
if (*mimeType) {
|
if (*mimeType) {
|
||||||
|
@ -927,13 +963,17 @@ public:
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Document version"), QString::number(container->doctypeVersion()));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Document version"), QString::number(container->doctypeVersion()));
|
||||||
}
|
}
|
||||||
if (container->doctypeReadVersion()) {
|
if (container->doctypeReadVersion()) {
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Document read version"), QString::number(container->doctypeReadVersion()));
|
rowMaker.mkRow(
|
||||||
|
QCoreApplication::translate("HtmlInfo", "Document read version"), QString::number(container->doctypeReadVersion()));
|
||||||
}
|
}
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Tag position"), container->determineTagPosition(m_diagReparsing));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Tag position"), container->determineTagPosition(m_diagReparsing));
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Index position"), container->determineIndexPosition(m_diagReparsing));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Index position"), container->determineIndexPosition(m_diagReparsing));
|
||||||
}
|
}
|
||||||
if (m_file.paddingSize()) {
|
if (m_file.paddingSize()) {
|
||||||
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Padding size"), QStringLiteral("%1 (%2 %)").arg(qstr(dataSizeToString(m_file.paddingSize(), true))).arg(static_cast<double>(m_file.paddingSize()) / m_file.size() * 100.0, 0, 'g', 2));
|
rowMaker.mkRow(QCoreApplication::translate("HtmlInfo", "Padding size"),
|
||||||
|
QStringLiteral("%1 (%2 %)")
|
||||||
|
.arg(qstr(dataSizeToString(m_file.paddingSize(), true)))
|
||||||
|
.arg(static_cast<double>(m_file.paddingSize()) / m_file.size() * 100.0, 0, 'g', 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_writer.writeEndElement();
|
m_writer.writeEndElement();
|
||||||
|
@ -945,7 +985,8 @@ public:
|
||||||
startTableSection();
|
startTableSection();
|
||||||
const QString moreId(QStringLiteral("tagsMore"));
|
const QString moreId(QStringLiteral("tagsMore"));
|
||||||
m_rowMaker.startRow(QCoreApplication::translate("HtmlInfo", "Tags"));
|
m_rowMaker.startRow(QCoreApplication::translate("HtmlInfo", "Tags"));
|
||||||
m_writer.writeCharacters(QCoreApplication::translate("HtmlInfo", "%1 tag(s) assigned", nullptr, static_cast<int>(tags.size())).arg(tags.size()));
|
m_writer.writeCharacters(
|
||||||
|
QCoreApplication::translate("HtmlInfo", "%1 tag(s) assigned", nullptr, static_cast<int>(tags.size())).arg(tags.size()));
|
||||||
mkSpace();
|
mkSpace();
|
||||||
mkDetailsLink(moreId, QCoreApplication::translate("HtmlInfo", "show details"));
|
mkDetailsLink(moreId, QCoreApplication::translate("HtmlInfo", "show details"));
|
||||||
m_rowMaker.endRow();
|
m_rowMaker.endRow();
|
||||||
|
@ -974,7 +1015,8 @@ public:
|
||||||
startTableSection();
|
startTableSection();
|
||||||
const QString moreId(QStringLiteral("tracksMore"));
|
const QString moreId(QStringLiteral("tracksMore"));
|
||||||
m_rowMaker.startRow(QCoreApplication::translate("HtmlInfo", "Tracks"));
|
m_rowMaker.startRow(QCoreApplication::translate("HtmlInfo", "Tracks"));
|
||||||
m_writer.writeCharacters(QCoreApplication::translate("HtmlInfo", "file has %1 track(s)", nullptr, static_cast<int>(tracks.size())).arg(tracks.size()));
|
m_writer.writeCharacters(
|
||||||
|
QCoreApplication::translate("HtmlInfo", "file has %1 track(s)", nullptr, static_cast<int>(tracks.size())).arg(tracks.size()));
|
||||||
const string summary(m_file.technicalSummary());
|
const string summary(m_file.technicalSummary());
|
||||||
if (!summary.empty()) {
|
if (!summary.empty()) {
|
||||||
m_writer.writeCharacters(QStringLiteral(": "));
|
m_writer.writeCharacters(QStringLiteral(": "));
|
||||||
|
@ -1001,7 +1043,9 @@ public:
|
||||||
startTableSection();
|
startTableSection();
|
||||||
const QString moreId(QStringLiteral("attachmentsMore"));
|
const QString moreId(QStringLiteral("attachmentsMore"));
|
||||||
m_rowMaker.startRow(QCoreApplication::translate("HtmlInfo", "Attachments"));
|
m_rowMaker.startRow(QCoreApplication::translate("HtmlInfo", "Attachments"));
|
||||||
m_writer.writeCharacters(QCoreApplication::translate("HtmlInfo", "%1 attachment(s) assigned", nullptr, static_cast<int>(attachments.size())).arg(attachments.size()));
|
m_writer.writeCharacters(
|
||||||
|
QCoreApplication::translate("HtmlInfo", "%1 attachment(s) assigned", nullptr, static_cast<int>(attachments.size()))
|
||||||
|
.arg(attachments.size()));
|
||||||
mkSpace();
|
mkSpace();
|
||||||
mkDetailsLink(moreId, QCoreApplication::translate("HtmlInfo", "show details"));
|
mkDetailsLink(moreId, QCoreApplication::translate("HtmlInfo", "show details"));
|
||||||
m_rowMaker.endRow();
|
m_rowMaker.endRow();
|
||||||
|
@ -1024,7 +1068,9 @@ public:
|
||||||
startTableSection();
|
startTableSection();
|
||||||
const QString moreId(QStringLiteral("editionsMore"));
|
const QString moreId(QStringLiteral("editionsMore"));
|
||||||
m_rowMaker.startRow(QCoreApplication::translate("HtmlInfo", "Editions/chapters"));
|
m_rowMaker.startRow(QCoreApplication::translate("HtmlInfo", "Editions/chapters"));
|
||||||
m_writer.writeCharacters(QCoreApplication::translate("HtmlInfo", "file has %1 edition(s)", nullptr, static_cast<int>(editionEntries.size())).arg(editionEntries.size()));
|
m_writer.writeCharacters(
|
||||||
|
QCoreApplication::translate("HtmlInfo", "file has %1 edition(s)", nullptr, static_cast<int>(editionEntries.size()))
|
||||||
|
.arg(editionEntries.size()));
|
||||||
mkSpace();
|
mkSpace();
|
||||||
mkDetailsLink(moreId, QCoreApplication::translate("HtmlInfo", "show details"));
|
mkDetailsLink(moreId, QCoreApplication::translate("HtmlInfo", "show details"));
|
||||||
m_rowMaker.endRow();
|
m_rowMaker.endRow();
|
||||||
|
@ -1042,7 +1088,8 @@ public:
|
||||||
startTableSection();
|
startTableSection();
|
||||||
const QString moreId(QStringLiteral("chaptersMore"));
|
const QString moreId(QStringLiteral("chaptersMore"));
|
||||||
m_rowMaker.startRow(QCoreApplication::translate("HtmlInfo", "chapters"));
|
m_rowMaker.startRow(QCoreApplication::translate("HtmlInfo", "chapters"));
|
||||||
m_writer.writeCharacters(QCoreApplication::translate("HtmlInfo", "file has %1 chapter(s)", nullptr, static_cast<int>(chapterCount)).arg(chapterCount));
|
m_writer.writeCharacters(
|
||||||
|
QCoreApplication::translate("HtmlInfo", "file has %1 chapter(s)", nullptr, static_cast<int>(chapterCount)).arg(chapterCount));
|
||||||
mkSpace();
|
mkSpace();
|
||||||
mkDetailsLink(moreId, QCoreApplication::translate("HtmlInfo", "show details"));
|
mkDetailsLink(moreId, QCoreApplication::translate("HtmlInfo", "show details"));
|
||||||
m_rowMaker.endRow();
|
m_rowMaker.endRow();
|
||||||
|
@ -1100,14 +1147,12 @@ public:
|
||||||
case ContainerFormat::Ebml:
|
case ContainerFormat::Ebml:
|
||||||
mkElementTree(static_cast<MatroskaContainer *>(m_file.container()));
|
mkElementTree(static_cast<MatroskaContainer *>(m_file.container()));
|
||||||
break;
|
break;
|
||||||
default:
|
default:;
|
||||||
;
|
|
||||||
}
|
}
|
||||||
m_rowMaker.endRow();
|
m_rowMaker.endRow();
|
||||||
m_writer.writeEndElement();
|
m_writer.writeEndElement();
|
||||||
break;
|
break;
|
||||||
default:
|
default:;
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// notifications
|
// notifications
|
||||||
|
@ -1154,4 +1199,4 @@ QByteArray generateInfo(const MediaFileInfo &file, Diagnostics &diag, Diagnostic
|
||||||
return gen.res();
|
return gen.res();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace HtmlInfo
|
||||||
|
|
|
@ -8,12 +8,11 @@
|
||||||
namespace TagParser {
|
namespace TagParser {
|
||||||
class MediaFileInfo;
|
class MediaFileInfo;
|
||||||
class Diagnostics;
|
class Diagnostics;
|
||||||
}
|
} // namespace TagParser
|
||||||
|
|
||||||
namespace HtmlInfo {
|
namespace HtmlInfo {
|
||||||
|
|
||||||
QByteArray generateInfo(const TagParser::MediaFileInfo &file, TagParser::Diagnostics &diag, TagParser::Diagnostics &diagReparsing);
|
QByteArray generateInfo(const TagParser::MediaFileInfo &file, TagParser::Diagnostics &diag, TagParser::Diagnostics &diagReparsing);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HTMLINFO_H
|
#endif // HTMLINFO_H
|
||||||
|
|
|
@ -3,30 +3,29 @@
|
||||||
#include "../application/settings.h"
|
#include "../application/settings.h"
|
||||||
|
|
||||||
#include <tagparser/exceptions.h>
|
#include <tagparser/exceptions.h>
|
||||||
#include <tagparser/signature.h>
|
|
||||||
#include <tagparser/mediafileinfo.h>
|
|
||||||
#include <tagparser/tag.h>
|
|
||||||
#include <tagparser/id3/id3v1tag.h>
|
#include <tagparser/id3/id3v1tag.h>
|
||||||
#include <tagparser/id3/id3v2tag.h>
|
#include <tagparser/id3/id3v2tag.h>
|
||||||
|
#include <tagparser/mediafileinfo.h>
|
||||||
|
#include <tagparser/signature.h>
|
||||||
|
#include <tagparser/tag.h>
|
||||||
|
|
||||||
#include <c++utilities/io/path.h>
|
#include <c++utilities/io/path.h>
|
||||||
|
|
||||||
|
#include <QAbstractItemModel>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
|
#include <QFileInfo>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include <QAbstractItemModel>
|
|
||||||
|
|
||||||
#include <ios>
|
#include <ios>
|
||||||
#include <stdexcept>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace TagParser;
|
using namespace TagParser;
|
||||||
|
|
||||||
namespace Utility
|
namespace Utility {
|
||||||
{
|
|
||||||
|
|
||||||
const char *textEncodingToCodecName(TagTextEncoding textEncoding)
|
const char *textEncodingToCodecName(TagTextEncoding textEncoding)
|
||||||
{
|
{
|
||||||
|
@ -57,8 +56,7 @@ QString tagValueToQString(const TagValue &value)
|
||||||
case TagDataType::TimeSpan:
|
case TagDataType::TimeSpan:
|
||||||
case TagDataType::PositionInSet:
|
case TagDataType::PositionInSet:
|
||||||
return QString::fromUtf8(value.toString().c_str());
|
return QString::fromUtf8(value.toString().c_str());
|
||||||
default:
|
default:;
|
||||||
;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return QString();
|
return QString();
|
||||||
|
@ -116,8 +114,7 @@ QString elementPositionToQString(ElementPosition elementPosition)
|
||||||
return QCoreApplication::translate("Utility", "before data");
|
return QCoreApplication::translate("Utility", "before data");
|
||||||
case ElementPosition::AfterData:
|
case ElementPosition::AfterData:
|
||||||
return QCoreApplication::translate("Utility", "after data");
|
return QCoreApplication::translate("Utility", "after data");
|
||||||
case ElementPosition::Keep:
|
case ElementPosition::Keep:;
|
||||||
;
|
|
||||||
}
|
}
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
@ -160,14 +157,11 @@ QString formatName(const QString &str, bool underscoreToWhitespace)
|
||||||
QString fixUmlauts(const QString &str)
|
QString fixUmlauts(const QString &str)
|
||||||
{
|
{
|
||||||
auto words = str.split(QChar(' '));
|
auto words = str.split(QChar(' '));
|
||||||
static const QLatin1String exceptions[] = {
|
static const QLatin1String exceptions[] = { QLatin1String("reggae"), QLatin1String("blues"), QLatin1String("auer"), QLatin1String("aues"),
|
||||||
QLatin1String("reggae"), QLatin1String("blues"), QLatin1String("auer"), QLatin1String("aues"), QLatin1String("manuel"),
|
QLatin1String("manuel"), QLatin1String("duet"), QLatin1String("neue"), QLatin1String("prologue") };
|
||||||
QLatin1String("duet"), QLatin1String("neue"), QLatin1String("prologue")
|
static const QLatin1String pairs[6][2] = { { QLatin1String("ae"), QLatin1String("\xe4") }, { QLatin1String("ue"), QLatin1String("\xfc") },
|
||||||
};
|
{ QLatin1String("oe"), QLatin1String("\xf6") }, { QLatin1String("Ae"), QLatin1String("\xc4") },
|
||||||
static const QLatin1String pairs[6][2] = {
|
{ QLatin1String("Ue"), QLatin1String("\xdc") }, { QLatin1String("Oe"), QLatin1String("\xd6") } };
|
||||||
{QLatin1String("ae"), QLatin1String("\xe4")}, {QLatin1String("ue"), QLatin1String("\xfc")}, {QLatin1String("oe"), QLatin1String("\xf6")},
|
|
||||||
{QLatin1String("Ae"), QLatin1String("\xc4")}, {QLatin1String("Ue"), QLatin1String("\xdc")}, {QLatin1String("Oe"), QLatin1String("\xd6")}
|
|
||||||
};
|
|
||||||
for (auto &word : words) {
|
for (auto &word : words) {
|
||||||
// preserve words containing any of the exceptions
|
// preserve words containing any of the exceptions
|
||||||
for (const auto &exception : exceptions) {
|
for (const auto &exception : exceptions) {
|
||||||
|
@ -194,9 +188,7 @@ void parseFileName(const QString &fileName, QString &title, int &trackNumber)
|
||||||
} else if (lastPoint == 0) {
|
} else if (lastPoint == 0) {
|
||||||
title.remove(0, 1);
|
title.remove(0, 1);
|
||||||
}
|
}
|
||||||
static const QLatin1String delims[] = {
|
static const QLatin1String delims[] = { QLatin1String(" - "), QLatin1String(", "), QLatin1String("-"), QLatin1String(" ") };
|
||||||
QLatin1String(" - "), QLatin1String(", "), QLatin1String("-"), QLatin1String(" ")
|
|
||||||
};
|
|
||||||
for (const auto &delim : delims) {
|
for (const auto &delim : delims) {
|
||||||
int lastDelimIndex = 0;
|
int lastDelimIndex = 0;
|
||||||
int delimIndex = title.indexOf(delim);
|
int delimIndex = title.indexOf(delim);
|
||||||
|
@ -259,4 +251,4 @@ void printModelIndex(const QModelIndex &index, QString &res, int level)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace Utility
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace TagParser {
|
||||||
class MediaFileInfo;
|
class MediaFileInfo;
|
||||||
class Tag;
|
class Tag;
|
||||||
enum class ElementPosition;
|
enum class ElementPosition;
|
||||||
}
|
} // namespace TagParser
|
||||||
|
|
||||||
namespace Utility {
|
namespace Utility {
|
||||||
|
|
||||||
|
@ -40,6 +40,6 @@ constexpr int trQuandity(quint64 quandity)
|
||||||
return quandity > std::numeric_limits<int>::max() ? std::numeric_limits<int>::max() : static_cast<int>(quandity);
|
return quandity > std::numeric_limits<int>::max() ? std::numeric_limits<int>::max() : static_cast<int>(quandity);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace Utility
|
||||||
|
|
||||||
#endif // UTILITYFEATURES_H
|
#endif // UTILITYFEATURES_H
|
||||||
|
|
Loading…
Reference in New Issue