Reduce indentation in `FileInfoModel::updateCache()`
This commit is contained in:
parent
ea6e670600
commit
60187d54c8
|
@ -278,7 +278,10 @@ void FileInfoModel::updateCache()
|
||||||
{
|
{
|
||||||
beginResetModel();
|
beginResetModel();
|
||||||
clear();
|
clear();
|
||||||
if (m_file) {
|
if (!m_file) {
|
||||||
|
endResetModel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
// get diag
|
// get diag
|
||||||
Diagnostics &diag = m_diagReparsing ? *m_diagReparsing : *m_diag;
|
Diagnostics &diag = m_diagReparsing ? *m_diagReparsing : *m_diag;
|
||||||
|
|
||||||
|
@ -341,9 +344,7 @@ void FileInfoModel::updateCache()
|
||||||
containerHelper.appendRow(tr("Padding size"), m_file->paddingSize());
|
containerHelper.appendRow(tr("Padding size"), m_file->paddingSize());
|
||||||
|
|
||||||
// tags
|
// tags
|
||||||
{
|
if (const auto tags = m_file->parsedTags(); !tags.empty()) {
|
||||||
const auto tags = m_file->parsedTags();
|
|
||||||
if (!tags.empty()) {
|
|
||||||
auto *tagsItem = defaultItem(tr("Tags"));
|
auto *tagsItem = defaultItem(tr("Tags"));
|
||||||
setItem(++currentRow, tagsItem);
|
setItem(++currentRow, tagsItem);
|
||||||
setItem(currentRow, 1, defaultItem(tr("%1 tag(s) assigned", nullptr, trQuandity(tags.size())).arg(tags.size())));
|
setItem(currentRow, 1, defaultItem(tr("%1 tag(s) assigned", nullptr, trQuandity(tags.size())).arg(tags.size())));
|
||||||
|
@ -360,12 +361,9 @@ void FileInfoModel::updateCache()
|
||||||
tagsItem->appendRow(tagItem);
|
tagsItem->appendRow(tagItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// tracks
|
// tracks
|
||||||
{
|
if (const auto tracks = m_file->tracks(); !tracks.empty()) {
|
||||||
const auto tracks = m_file->tracks();
|
|
||||||
if (!tracks.empty()) {
|
|
||||||
auto *tracksItem = defaultItem(tr("Tracks"));
|
auto *tracksItem = defaultItem(tr("Tracks"));
|
||||||
setItem(++currentRow, tracksItem);
|
setItem(++currentRow, tracksItem);
|
||||||
const string summary(m_file->technicalSummary());
|
const string summary(m_file->technicalSummary());
|
||||||
|
@ -497,12 +495,9 @@ void FileInfoModel::updateCache()
|
||||||
tracksItem->appendRow(trackItem);
|
tracksItem->appendRow(trackItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// attachments
|
// attachments
|
||||||
{
|
if (const auto attachments = m_file->attachments(); !attachments.empty()) {
|
||||||
const auto attachments = m_file->attachments();
|
|
||||||
if (!attachments.empty()) {
|
|
||||||
auto *attachmentsItem = defaultItem(tr("Attachments"));
|
auto *attachmentsItem = defaultItem(tr("Attachments"));
|
||||||
setItem(++currentRow, attachmentsItem);
|
setItem(++currentRow, attachmentsItem);
|
||||||
setItem(currentRow, 1, defaultItem(tr("%1 attachment(s) present", nullptr, trQuandity(attachments.size())).arg(attachments.size())));
|
setItem(currentRow, 1, defaultItem(tr("%1 attachment(s) present", nullptr, trQuandity(attachments.size())).arg(attachments.size())));
|
||||||
|
@ -519,7 +514,6 @@ void FileInfoModel::updateCache()
|
||||||
attachmentsItem->appendRow(attachmentItem);
|
attachmentsItem->appendRow(attachmentItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// chapters/editions
|
// chapters/editions
|
||||||
{
|
{
|
||||||
|
@ -566,8 +560,8 @@ void FileInfoModel::updateCache()
|
||||||
if (!editionEntries.empty()) {
|
if (!editionEntries.empty()) {
|
||||||
auto *editionsItem = defaultItem(tr("Editions"));
|
auto *editionsItem = defaultItem(tr("Editions"));
|
||||||
setItem(++currentRow, editionsItem);
|
setItem(++currentRow, editionsItem);
|
||||||
setItem(currentRow, 1,
|
setItem(
|
||||||
defaultItem(tr("%1 edition(s) present", nullptr, trQuandity(editionEntries.size())).arg(editionEntries.size())));
|
currentRow, 1, defaultItem(tr("%1 edition(s) present", nullptr, trQuandity(editionEntries.size())).arg(editionEntries.size())));
|
||||||
size_t editionNumber = 0;
|
size_t editionNumber = 0;
|
||||||
for (const auto &edition : editionEntries) {
|
for (const auto &edition : editionEntries) {
|
||||||
auto *editionItem = defaultItem(tr("Edition #%1").arg(++editionNumber));
|
auto *editionItem = defaultItem(tr("Edition #%1").arg(++editionNumber));
|
||||||
|
@ -592,9 +586,7 @@ void FileInfoModel::updateCache()
|
||||||
editionsItem->appendRow(editionItem);
|
editionsItem->appendRow(editionItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else if (const auto chapters = m_file->chapters(); !chapters.empty()) {
|
||||||
const auto chapters = m_file->chapters();
|
|
||||||
if (!chapters.empty()) {
|
|
||||||
auto *chaptersItem = defaultItem(tr("Chapters"));
|
auto *chaptersItem = defaultItem(tr("Chapters"));
|
||||||
setItem(++currentRow, chaptersItem);
|
setItem(++currentRow, chaptersItem);
|
||||||
setItem(currentRow, 1, defaultItem(tr("%1 chapter(s) present", nullptr, trQuandity(chapters.size())).arg(chapters.size())));
|
setItem(currentRow, 1, defaultItem(tr("%1 chapter(s) present", nullptr, trQuandity(chapters.size())).arg(chapters.size())));
|
||||||
|
@ -603,7 +595,6 @@ void FileInfoModel::updateCache()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// structure
|
// structure
|
||||||
switch (m_file->containerFormat()) {
|
switch (m_file->containerFormat()) {
|
||||||
|
@ -640,7 +631,6 @@ void FileInfoModel::updateCache()
|
||||||
addDiagMessages(m_diagReparsing, diagReparsingItem);
|
addDiagMessages(m_diagReparsing, diagReparsingItem);
|
||||||
setItem(++currentRow, diagReparsingItem);
|
setItem(++currentRow, diagReparsingItem);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue