Fix warnings
This commit is contained in:
parent
8158ef930a
commit
e535e20720
|
@ -506,15 +506,15 @@ void setTagInfo(const SetTagInfoArgs &args)
|
|||
static string context("setting tags");
|
||||
for (const char *file : args.filesArg.values()) {
|
||||
Diagnostics diag;
|
||||
AbortableProgressFeedback progress; // FIXME: actually use the progress object
|
||||
AbortableProgressFeedback parsingProgress; // FIXME: actually use the progress object
|
||||
try {
|
||||
// parse tags and tracks (tracks are relevent because track meta-data such as language can be changed as well)
|
||||
cout << TextAttribute::Bold << "Setting tag information for \"" << file << "\" ..." << Phrases::EndFlush;
|
||||
fileInfo.setPath(file);
|
||||
fileInfo.parseContainerFormat(diag, progress);
|
||||
fileInfo.parseTags(diag, progress);
|
||||
fileInfo.parseTracks(diag, progress);
|
||||
fileInfo.parseAttachments(diag, progress);
|
||||
fileInfo.parseContainerFormat(diag, parsingProgress);
|
||||
fileInfo.parseTags(diag, parsingProgress);
|
||||
fileInfo.parseTracks(diag, parsingProgress);
|
||||
fileInfo.parseAttachments(diag, parsingProgress);
|
||||
vector<Tag *> tags;
|
||||
|
||||
// remove tags with the specified targets
|
||||
|
@ -618,16 +618,16 @@ void setTagInfo(const SetTagInfoArgs &args)
|
|||
// add value from file
|
||||
try {
|
||||
// assume the file refers to a picture
|
||||
MediaFileInfo fileInfo(relevantDenotedValue->value);
|
||||
Diagnostics diag;
|
||||
AbortableProgressFeedback progress; // FIXME: actually use the progress object
|
||||
fileInfo.open(true);
|
||||
fileInfo.parseContainerFormat(diag, progress);
|
||||
auto buff = make_unique<char[]>(fileInfo.size());
|
||||
fileInfo.stream().seekg(static_cast<streamoff>(fileInfo.containerOffset()));
|
||||
fileInfo.stream().read(buff.get(), static_cast<streamoff>(fileInfo.size()));
|
||||
TagValue value(move(buff), fileInfo.size(), TagDataType::Picture);
|
||||
value.setMimeType(fileInfo.mimeType());
|
||||
MediaFileInfo coverFileInfo(relevantDenotedValue->value);
|
||||
Diagnostics coverDiag;
|
||||
AbortableProgressFeedback coverProgress; // FIXME: actually use the progress object
|
||||
coverFileInfo.open(true);
|
||||
coverFileInfo.parseContainerFormat(coverDiag, coverProgress);
|
||||
auto buff = make_unique<char[]>(coverFileInfo.size());
|
||||
coverFileInfo.stream().seekg(static_cast<streamoff>(coverFileInfo.containerOffset()));
|
||||
coverFileInfo.stream().read(buff.get(), static_cast<streamoff>(coverFileInfo.size()));
|
||||
TagValue value(move(buff), coverFileInfo.size(), TagDataType::Picture);
|
||||
value.setMimeType(coverFileInfo.mimeType());
|
||||
convertedValues.emplace_back(move(value));
|
||||
} catch (const TagParser::Failure &) {
|
||||
diag.emplace_back(DiagLevel::Critical, "Unable to parse specified cover file.", context);
|
||||
|
@ -703,8 +703,8 @@ void setTagInfo(const SetTagInfoArgs &args)
|
|||
bool attachmentsModified = false;
|
||||
if (args.addAttachmentArg.isPresent() || args.updateAttachmentArg.isPresent() || args.removeAttachmentArg.isPresent()
|
||||
|| args.removeExistingAttachmentsArg.isPresent()) {
|
||||
static const string context("setting attachments");
|
||||
fileInfo.parseAttachments(diag, progress);
|
||||
static const string attachmentsContext("setting attachments");
|
||||
fileInfo.parseAttachments(diag, parsingProgress);
|
||||
if (fileInfo.attachmentsParsingStatus() == ParsingStatus::Ok && container) {
|
||||
// ignore all existing attachments if argument is specified
|
||||
if (args.removeExistingAttachmentsArg.isPresent()) {
|
||||
|
@ -737,8 +737,8 @@ void setTagInfo(const SetTagInfoArgs &args)
|
|||
attachmentsModified |= currentInfo.next(container, diag);
|
||||
}
|
||||
} else {
|
||||
diag.emplace_back(
|
||||
DiagLevel::Critical, "Unable to assign attachments because the container object has not been initialized.", context);
|
||||
diag.emplace_back(DiagLevel::Critical, "Unable to assign attachments because the container object has not been initialized.",
|
||||
attachmentsContext);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -746,11 +746,11 @@ void setTagInfo(const SetTagInfoArgs &args)
|
|||
fileInfo.setSaveFilePath(currentOutputFile != noMoreOutputFiles ? string(*currentOutputFile) : string());
|
||||
try {
|
||||
// create handler for progress updates and aborting
|
||||
AbortableProgressFeedback progress(logNextStep, logStepPercentage);
|
||||
const InterruptHandler handler(bind(&AbortableProgressFeedback::tryToAbort, ref(progress)));
|
||||
AbortableProgressFeedback applyProgress(logNextStep, logStepPercentage);
|
||||
const InterruptHandler handler(bind(&AbortableProgressFeedback::tryToAbort, ref(applyProgress)));
|
||||
|
||||
// apply changes
|
||||
fileInfo.applyChanges(diag, progress);
|
||||
fileInfo.applyChanges(diag, applyProgress);
|
||||
|
||||
// notify about completion
|
||||
finalizeLog();
|
||||
|
@ -855,7 +855,7 @@ void extractField(
|
|||
: outputFileArg.values().front();
|
||||
try {
|
||||
outputFileStream.open(path, ios_base::out | ios_base::binary);
|
||||
outputFileStream.write(value.first->dataPointer(), value.first->dataSize());
|
||||
outputFileStream.write(value.first->dataPointer(), static_cast<std::streamsize>(value.first->dataSize()));
|
||||
outputFileStream.flush();
|
||||
cout << " - Value has been saved to \"" << path << "\"." << endl;
|
||||
} catch (const std::ios_base::failure &) {
|
||||
|
@ -865,7 +865,7 @@ void extractField(
|
|||
} else {
|
||||
// write data to stdout if no output file has been specified
|
||||
for (const auto &value : values) {
|
||||
cout.write(value.first->dataPointer(), value.first->dataSize());
|
||||
cout.write(value.first->dataPointer(), static_cast<std::streamsize>(value.first->dataSize()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -86,7 +86,7 @@ TagValue QueryResultsModel::fieldValue(int row, KnownField knownField) const
|
|||
case KnownField::Cover:
|
||||
if (!res.cover.isEmpty()) {
|
||||
TagValue tagValue(res.cover.data(), static_cast<size_t>(res.cover.size()), TagDataType::Picture);
|
||||
tagValue.setMimeType(containerMimeType(parseSignature(res.cover.data(), res.cover.size())));
|
||||
tagValue.setMimeType(containerMimeType(parseSignature(res.cover.data(), static_cast<std::size_t>(res.cover.size()))));
|
||||
return tagValue;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -251,14 +251,14 @@ void MusicBrainzResultsModel::parseInitialResults(const QByteArray &data)
|
|||
}
|
||||
// -> sort recordings within each release by track number and add recordings to results
|
||||
for (auto &releaseAndRecordings : recordingsByRelease) {
|
||||
auto &recordings = releaseAndRecordings.second;
|
||||
std::sort(recordings.begin(), recordings.end(), [](const auto &recording1, const auto &recording2) {
|
||||
auto &recordingsOfRelease = releaseAndRecordings.second;
|
||||
std::sort(recordingsOfRelease.begin(), recordingsOfRelease.end(), [](const auto &recording1, const auto &recording2) {
|
||||
if (recording1.disk != recording2.disk) {
|
||||
return recording1.disk < recording2.disk;
|
||||
}
|
||||
return recording1.track < recording2.track;
|
||||
});
|
||||
for (auto &recording : recordings) {
|
||||
for (auto &recording : recordingsOfRelease) {
|
||||
m_results << move(recording);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ void AttachmentsEdit::setFileInfo(TagParser::MediaFileInfo *fileInfo, bool updat
|
|||
if (fileInfo && fileInfo->areAttachmentsSupported()) {
|
||||
if (AbstractContainer *container = fileInfo->container()) {
|
||||
auto count = container->attachmentCount();
|
||||
m_currentAttachments.reserve(count);
|
||||
m_currentAttachments.reserve(static_cast<decltype(m_currentAttachments)::size_type>(count));
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
m_currentAttachments << container->attachment(i);
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ void AttachmentsEdit::extractSelected()
|
|||
NativeFileStream file;
|
||||
file.exceptions(ios_base::badbit | ios_base::failbit);
|
||||
try {
|
||||
input.seekg(data->startOffset());
|
||||
input.seekg(static_cast<std::streamoff>(data->startOffset()), std::ios_base::beg);
|
||||
file.open(toNativeFileName(fileName).data(), ios_base::out | ios_base::binary);
|
||||
CopyHelper<0x1000> helper;
|
||||
helper.copy(input, file, data->size());
|
||||
|
|
|
@ -189,6 +189,7 @@ Qt::ItemFlags AttachmentsModel::flags(const QModelIndex &index) const
|
|||
switch (index.column()) {
|
||||
case 0:
|
||||
flags |= Qt::ItemIsUserCheckable;
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
flags |= Qt::ItemIsEditable;
|
||||
|
|
|
@ -508,8 +508,8 @@ void DbQueryWidget::applyResults(TagEdit *tagEdit, const QModelIndex &resultInde
|
|||
if (row != index.row()) {
|
||||
return;
|
||||
}
|
||||
if (auto *const tagEdit = m_tagEditorWidget->activeTagEdit()) {
|
||||
tagEdit->setValue(KnownField::Cover, m_model->fieldValue(row, KnownField::Cover), previousValueHandling);
|
||||
if (auto *const activeTagEdit = m_tagEditorWidget->activeTagEdit()) {
|
||||
activeTagEdit->setValue(KnownField::Cover, m_model->fieldValue(row, KnownField::Cover), previousValueHandling);
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
@ -531,8 +531,8 @@ void DbQueryWidget::applyResults(TagEdit *tagEdit, const QModelIndex &resultInde
|
|||
if (row != index.row()) {
|
||||
return;
|
||||
}
|
||||
if (auto *const tagEdit = m_tagEditorWidget->activeTagEdit()) {
|
||||
tagEdit->setValue(KnownField::Lyrics, m_model->fieldValue(row, KnownField::Lyrics), previousValueHandling);
|
||||
if (auto *const activeTagEdit = m_tagEditorWidget->activeTagEdit()) {
|
||||
activeTagEdit->setValue(KnownField::Lyrics, m_model->fieldValue(row, KnownField::Lyrics), previousValueHandling);
|
||||
}
|
||||
});
|
||||
break;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <tagparser/mediafileinfo.h>
|
||||
#include <tagparser/signature.h>
|
||||
|
||||
#include <qtutilities/misc/conversion.h>
|
||||
#include <qtutilities/misc/dialogutils.h>
|
||||
#include <qtutilities/models/checklistmodel.h>
|
||||
|
||||
|
@ -89,9 +90,8 @@ EnterTargetDialog::~EnterTargetDialog()
|
|||
|
||||
void EnterTargetDialog::updateLevelNamePlaceholderText(int i)
|
||||
{
|
||||
const auto levelName
|
||||
= i >= 0 ? tagTargetLevelName(containerTargetLevel(m_currentContainerFormat, static_cast<std::uint32_t>(i))) : std::string_view();
|
||||
m_ui->levelNameLineEdit->setPlaceholderText(QString::fromUtf8(levelName.data(), levelName.size()));
|
||||
m_ui->levelNameLineEdit->setPlaceholderText(qstringFromStdStringView(
|
||||
i >= 0 ? tagTargetLevelName(containerTargetLevel(m_currentContainerFormat, static_cast<std::uint32_t>(i))) : std::string_view()));
|
||||
}
|
||||
|
||||
TagParser::TagTarget EnterTargetDialog::target() const
|
||||
|
|
|
@ -51,7 +51,7 @@ QStandardItem *defaultItem(const QString &text)
|
|||
|
||||
QStandardItem *defaultItem(std::string_view text)
|
||||
{
|
||||
return defaultItem(QString::fromUtf8(text.data(), text.size()));
|
||||
return defaultItem(qstringFromStdStringView(text));
|
||||
}
|
||||
|
||||
class ItemHelper {
|
||||
|
@ -72,7 +72,7 @@ public:
|
|||
void appendRow(const QString &label, std::string_view text)
|
||||
{
|
||||
if (!text.empty()) {
|
||||
appendRow(label, QString::fromUtf8(text.data(), text.size()));
|
||||
appendRow(label, qstringFromStdStringView(text));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -313,10 +313,9 @@ void FileInfoModel::updateCache()
|
|||
QString containerName;
|
||||
const auto containerFormatName = m_file->containerFormatName();
|
||||
if (const auto subversion = m_file->containerFormatSubversion(); !subversion.empty()) {
|
||||
containerName = QString::fromUtf8(containerFormatName.data(), containerFormatName.size()) % QChar(' ')
|
||||
% QString::fromUtf8(subversion.data(), subversion.size());
|
||||
containerName = qstringFromStdStringView(containerFormatName) % QChar(' ') % qstringFromStdStringView(subversion);
|
||||
} else {
|
||||
containerName = QString::fromUtf8(containerFormatName.data(), containerFormatName.size());
|
||||
containerName = qstringFromStdStringView(containerFormatName);
|
||||
}
|
||||
setItem(currentRow, 1, defaultItem(containerName));
|
||||
|
||||
|
@ -465,8 +464,8 @@ void FileInfoModel::updateCache()
|
|||
if (const auto cc = track->channelConfigString(); !cc.empty()) {
|
||||
const auto ecc = track->extensionChannelConfigString();
|
||||
trackHelper.appendRow(tr("Channel config"),
|
||||
!ecc.empty() ? QString::fromUtf8(ecc.data(), ecc.size()) % QStringLiteral(" / ") % QString::fromUtf8(cc.data(), cc.size())
|
||||
: QString::fromUtf8(cc.data(), cc.size()));
|
||||
!ecc.empty() ? qstringFromStdStringView(ecc) % QStringLiteral(" / ") % qstringFromStdStringView(cc)
|
||||
: qstringFromStdStringView(cc));
|
||||
} else {
|
||||
trackHelper.appendRow(tr("Channel count"), track->channelCount());
|
||||
}
|
||||
|
|
|
@ -452,14 +452,14 @@ void MainWindow::selectNextFile(QItemSelectionModel *selectionModel, const QMode
|
|||
[this, selectionModel, currentIndex, conn](const QModelIndex &parent, int, int) {
|
||||
disconnect(*conn);
|
||||
if (parent == currentIndex) {
|
||||
const QModelIndex next = m_fileFilterModel->index(0, 0, parent);
|
||||
if (next.isValid()) {
|
||||
if (m_ui->filesTreeView->model()->hasChildren(next)) {
|
||||
const QModelIndex nextFetched = m_fileFilterModel->index(0, 0, parent);
|
||||
if (nextFetched.isValid()) {
|
||||
if (m_ui->filesTreeView->model()->hasChildren(nextFetched)) {
|
||||
// next item is a directory -> keep on searching
|
||||
selectNextFile(selectionModel, next, false);
|
||||
selectNextFile(selectionModel, nextFetched, false);
|
||||
} else {
|
||||
m_ui->filesTreeView->selectionModel()->setCurrentIndex(
|
||||
next, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
||||
nextFetched, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
||||
}
|
||||
} else {
|
||||
selectNextFile(selectionModel, currentIndex, true);
|
||||
|
|
|
@ -347,11 +347,11 @@ template <class TagType> void pushId3v2CoverValues(TagType *tag, KnownField fiel
|
|||
using FieldType = typename TagType::FieldType;
|
||||
using TypeInfoType = typename FieldType::TypeInfoType;
|
||||
using IndexCompareType = typename Traits::Conditional<std::is_unsigned<TypeInfoType>, make_unsigned<decltype(index)>::type, TypeInfoType>;
|
||||
FieldType field(id, values[index]);
|
||||
auto newField = FieldType(id, values[index]);
|
||||
if (static_cast<IndexCompareType>(index) < numeric_limits<TypeInfoType>::max()) {
|
||||
field.setTypeInfo(static_cast<TypeInfoType>(index));
|
||||
newField.setTypeInfo(static_cast<TypeInfoType>(index));
|
||||
}
|
||||
fields.insert(std::make_pair(id, field));
|
||||
fields.insert(std::make_pair(id, newField));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -422,8 +422,7 @@ void PicturePreviewSelection::addOfSelectedType(const QString &path)
|
|||
fileInfo.open(true);
|
||||
fileInfo.parseContainerFormat(diag, progress);
|
||||
|
||||
const auto detectedMimeType = fileInfo.mimeType();
|
||||
auto mimeType = QString::fromUtf8(detectedMimeType.data(), detectedMimeType.size());
|
||||
auto mimeType = qstringFromStdStringView(fileInfo.mimeType());
|
||||
bool ok;
|
||||
mimeType = QInputDialog::getText(
|
||||
this, tr("Enter/confirm MIME type"), tr("Confirm or enter the MIME type of the selected file."), QLineEdit::Normal, mimeType, &ok);
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
#include <tagparser/tag.h>
|
||||
|
||||
#include <qtutilities/misc/conversion.h>
|
||||
|
||||
#include <c++utilities/conversion/stringconversion.h>
|
||||
|
||||
#include <QFormLayout>
|
||||
|
@ -199,8 +201,7 @@ QString TagEdit::generateLabel() const
|
|||
QStringList tagNames;
|
||||
tagNames.reserve(m_tags.size());
|
||||
for (const Tag *const tag : m_tags) {
|
||||
const auto typeName = tag->typeName();
|
||||
tagNames << QString::fromUtf8(typeName.data(), typeName.size());
|
||||
tagNames << QtUtilities::qstringFromStdStringView(tag->typeName());
|
||||
if (!differentTargets && !(target == tag->target())) {
|
||||
differentTargets = true;
|
||||
}
|
||||
|
@ -212,7 +213,7 @@ QString TagEdit::generateLabel() const
|
|||
if (differentTargets) {
|
||||
res.append(tr(" with different targets"));
|
||||
} else if (haveMatroskaTags || !target.isEmpty()) {
|
||||
res.append(tr(" targeting %1").arg(QString::fromUtf8(m_tags.front()->targetString().c_str())));
|
||||
res.append(tr(" targeting %1").arg(QString::fromStdString(m_tags.front()->targetString())));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -411,17 +411,18 @@ void TagEditorWidget::updateTagEditsAndAttachmentEdits(bool updateUi, PreviousVa
|
|||
|
||||
// add/update AttachmentsEdit widget
|
||||
if (m_fileInfo.areAttachmentsSupported()) {
|
||||
AttachmentsEdit *edit;
|
||||
AttachmentsEdit *attachmentsEdit;
|
||||
// reuse existing edit (assigned in if-condition!) or ...
|
||||
if ((widgetIndex < m_ui->stackedWidget->count()) && (edit = qobject_cast<AttachmentsEdit *>(m_ui->stackedWidget->widget(widgetIndex)))) {
|
||||
edit->setFileInfo(&m_fileInfo, true);
|
||||
if ((widgetIndex < m_ui->stackedWidget->count())
|
||||
&& (attachmentsEdit = qobject_cast<AttachmentsEdit *>(m_ui->stackedWidget->widget(widgetIndex)))) {
|
||||
attachmentsEdit->setFileInfo(&m_fileInfo, true);
|
||||
} else {
|
||||
// ... create and add a new edit
|
||||
edit = new AttachmentsEdit(&m_fileInfo, this);
|
||||
connect(m_ui->clearEntriesPushButton, &QPushButton::clicked, edit, &AttachmentsEdit::clear);
|
||||
connect(m_ui->restoreEntriesPushButton, &QPushButton::clicked, edit, &AttachmentsEdit::restore);
|
||||
attachmentsEdit = new AttachmentsEdit(&m_fileInfo, this);
|
||||
connect(m_ui->clearEntriesPushButton, &QPushButton::clicked, attachmentsEdit, &AttachmentsEdit::clear);
|
||||
connect(m_ui->restoreEntriesPushButton, &QPushButton::clicked, attachmentsEdit, &AttachmentsEdit::restore);
|
||||
//connect(edit, &AttachmentsEdit::returnPressed, this, &TagEditorWidget::handleReturnPressed);
|
||||
m_ui->stackedWidget->insertWidget(widgetIndex, edit);
|
||||
m_ui->stackedWidget->insertWidget(widgetIndex, attachmentsEdit);
|
||||
}
|
||||
++widgetIndex;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <tagparser/tag.h>
|
||||
#include <tagparser/tagvalue.h>
|
||||
|
||||
#include <qtutilities/misc/conversion.h>
|
||||
#include <qtutilities/widgets/clearcombobox.h>
|
||||
#include <qtutilities/widgets/clearlineedit.h>
|
||||
#include <qtutilities/widgets/clearplaintextedit.h>
|
||||
|
@ -572,9 +573,9 @@ bool TagFieldEdit::updateValue(const TagValue &value, PreviousValueHandling prev
|
|||
if (m_lineEdit || m_comboBox || m_plainTextEdit) {
|
||||
const auto text([&] {
|
||||
try {
|
||||
const auto text(Utility::tagValueToQString(value));
|
||||
const auto correctedText = applyAutoCorrection(text);
|
||||
if (correctedText != text) {
|
||||
const auto textValue = Utility::tagValueToQString(value);
|
||||
const auto correctedText = applyAutoCorrection(textValue);
|
||||
if (correctedText != textValue) {
|
||||
autoCorrectionApplied = true;
|
||||
}
|
||||
return correctedText;
|
||||
|
@ -699,17 +700,17 @@ bool TagFieldEdit::updateValue(const TagValue &value, PreviousValueHandling prev
|
|||
}
|
||||
const auto pixmap(QIcon::fromTheme(QStringLiteral("emblem-error")).pixmap(16));
|
||||
const auto text([&] {
|
||||
QString text;
|
||||
QString textValue;
|
||||
if (conversionError) {
|
||||
text = tr("The value of this field could not be read from the file because it couldn't be converted properly.");
|
||||
textValue = tr("The value of this field could not be read from the file because it couldn't be converted properly.");
|
||||
if (!canApplyField) {
|
||||
text += QChar('\n');
|
||||
textValue += QChar('\n');
|
||||
}
|
||||
}
|
||||
if (!canApplyField) {
|
||||
text += tr("The field can not be applied when saving the file and will be lost.");
|
||||
textValue += tr("The field can not be applied when saving the file and will be lost.");
|
||||
}
|
||||
return text;
|
||||
return textValue;
|
||||
}());
|
||||
for (auto *const overlay : widgets) {
|
||||
if (overlay) {
|
||||
|
@ -919,9 +920,7 @@ void TagFieldEdit::handleRestoreButtonClicked()
|
|||
QMenu menu;
|
||||
int i = 0;
|
||||
for (auto *const tag : tags()) {
|
||||
const auto typeName = tag->typeName();
|
||||
const auto *const action
|
||||
= menu.addAction(tr("restore to value from %1 (%2)").arg(QString::fromUtf8(typeName.data(), typeName.size())).arg(++i));
|
||||
const auto *const action = menu.addAction(tr("restore to value from %1 (%2)").arg(qstringFromStdStringView(tag->typeName())).arg(++i));
|
||||
connect(action, &QAction::triggered, [this, tag] {
|
||||
setLocked(false);
|
||||
updateValue(tag, PreviousValueHandling::Clear);
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <tagparser/mp4/mp4container.h>
|
||||
#include <tagparser/signature.h>
|
||||
|
||||
#include <qtutilities/misc/conversion.h>
|
||||
#include <qtutilities/resources/resources.h>
|
||||
|
||||
#include <c++utilities/chrono/datetime.h>
|
||||
|
@ -276,7 +277,7 @@ template <> void mkElementContent(QXmlStreamWriter &writer, EbmlElement *element
|
|||
const auto seekIdName = matroskaIdName(static_cast<std::uint32_t>(seekId));
|
||||
if (!seekIdName.empty()) {
|
||||
writer.writeCharacters(QStringLiteral(" \""));
|
||||
writer.writeCharacters(QString::fromLatin1(seekIdName.data(), seekIdName.size()));
|
||||
writer.writeCharacters(qstringFromStdStringView(seekIdName));
|
||||
writer.writeCharacters(QStringLiteral("\""));
|
||||
}
|
||||
}
|
||||
|
@ -962,7 +963,7 @@ public:
|
|||
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));
|
||||
.arg(static_cast<double>(m_file.paddingSize()) / static_cast<double>(m_file.size()) * 100.0, 0, 'g', 2));
|
||||
}
|
||||
|
||||
m_writer.writeEndElement();
|
||||
|
|
|
@ -124,8 +124,8 @@ string qstringToString(const QString &value, TagTextEncoding textEncoding)
|
|||
#else
|
||||
case TagTextEncoding::Utf16BigEndian:
|
||||
#endif
|
||||
encodedString = QByteArray(
|
||||
reinterpret_cast<const char *>(value.utf16()), static_cast<int>(value.size() * static_cast<int>(sizeof(ushort) / sizeof(char))));
|
||||
encodedString = QByteArray(reinterpret_cast<const char *>(value.utf16()),
|
||||
static_cast<QByteArray::size_type>(value.size()) * static_cast<QByteArray::size_type>(sizeof(ushort) / sizeof(char)));
|
||||
break;
|
||||
#if defined(CONVERSION_UTILITIES_BYTE_ORDER_LITTLE_ENDIAN)
|
||||
case TagTextEncoding::Utf16BigEndian: {
|
||||
|
@ -139,7 +139,7 @@ string qstringToString(const QString &value, TagTextEncoding textEncoding)
|
|||
"UTF-16BE",
|
||||
#endif
|
||||
textEncodingToCodecName(textEncoding), reinterpret_cast<const char *>(value.utf16()),
|
||||
static_cast<int>(value.size() * static_cast<int>(sizeof(ushort) / sizeof(char))), 2.0f);
|
||||
static_cast<std::size_t>(value.size()) * (sizeof(ushort) / sizeof(char)), 2.0f);
|
||||
return string(utf16Data.first.get(), utf16Data.second);
|
||||
}
|
||||
}
|
||||
|
@ -243,9 +243,9 @@ void parseFileName(const QString &fileName, QString &title, int &trackNumber)
|
|||
trackNumber = QtUtilities::midRef(title, lastDelimIndex, delimIndex - lastDelimIndex).toInt(&ok);
|
||||
if (ok) {
|
||||
int titleStart = delimIndex + delim.size();
|
||||
for (const auto &delim : delims) {
|
||||
if (QtUtilities::midRef(title, titleStart).startsWith(delim)) {
|
||||
titleStart += delim.size();
|
||||
for (const auto &delim2 : delims) {
|
||||
if (QtUtilities::midRef(title, titleStart).startsWith(delim2)) {
|
||||
titleStart += delim2.size();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue