mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-10-06 09:17:07 +02:00
File formatting
This commit is contained in:
parent
43cf3584d2
commit
143323de8f
@ -157,7 +157,7 @@ QVariant InstalledListModel::data(const QModelIndex& index, int role) const
|
||||
case static_cast<int>(ScreenPlayItem::SearchType):
|
||||
return QVariant::fromValue(m_screenPlayFiles.at(row).m_searchType);
|
||||
case static_cast<int>(ScreenPlayItem::SizeBytes):
|
||||
return QVariant::fromValue(m_screenPlayFiles.at(row).m_Size);
|
||||
return QVariant::fromValue(m_screenPlayFiles.at(row).m_sizeBytes);
|
||||
}
|
||||
|
||||
qWarning() << "Unable to fetch value for row type:" << role;
|
||||
@ -182,17 +182,17 @@ QHash<int, QByteArray> InstalledListModel::roleNames() const
|
||||
{ static_cast<int>(ScreenPlayItem::SearchType), "m_searchType" },
|
||||
{ static_cast<int>(ScreenPlayItem::IsNew), "m_isNew" },
|
||||
{ static_cast<int>(ScreenPlayItem::LastModified), "m_lastModified" },
|
||||
{ static_cast<int>(ScreenPlayItem::SizeBytes),"m_Size"}
|
||||
{ static_cast<int>(ScreenPlayItem::SizeBytes), "m_sizeBytes" }
|
||||
};
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Append an ProjectFile to the list.
|
||||
*/
|
||||
void InstalledListModel::append(const QJsonObject& obj, const QString& folderName, const bool isNew, const QDateTime& lastModified,const int sizeBytes)
|
||||
void InstalledListModel::append(const QJsonObject& obj, const QString& folderName, const bool isNew, const QDateTime& lastModified, const int sizeBytes)
|
||||
{
|
||||
beginInsertRows(QModelIndex(), m_screenPlayFiles.size(), m_screenPlayFiles.size());
|
||||
m_screenPlayFiles.append(ProjectFile(obj, folderName, m_globalVariables->localStoragePath(), isNew, lastModified,sizeBytes));
|
||||
m_screenPlayFiles.append(ProjectFile(obj, folderName, m_globalVariables->localStoragePath(), isNew, lastModified, sizeBytes));
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
@ -222,17 +222,16 @@ void InstalledListModel::loadInstalledContent()
|
||||
|
||||
if (item.birthTime().date() == QDateTime::currentDateTime().date())
|
||||
isNew = true;
|
||||
int sizeBytes ;
|
||||
QDirIterator dirs(m_globalVariables->localStoragePath().toLocalFile(),(QDir::Filter::NoDotAndDotDot | QDir::Filter::Dirs));
|
||||
while (dirs.hasNext()) {
|
||||
QDirIterator projectIterator(dirs.next(), (QDir::Filter::Files | QDir::Filter::NoDotAndDotDot ));
|
||||
sizeBytes=0;
|
||||
while (projectIterator.hasNext()) {
|
||||
int sizeBytes;
|
||||
QDirIterator dirs(m_globalVariables->localStoragePath().toLocalFile(), (QDir::Filter::NoDotAndDotDot | QDir::Filter::Dirs));
|
||||
while (dirs.hasNext()) {
|
||||
QDirIterator projectIterator(dirs.next(), (QDir::Filter::Files | QDir::Filter::NoDotAndDotDot));
|
||||
sizeBytes = 0;
|
||||
while (projectIterator.hasNext()) {
|
||||
|
||||
sizeBytes += QFileInfo( projectIterator.next()).size();
|
||||
}
|
||||
|
||||
}
|
||||
sizeBytes += QFileInfo(projectIterator.next()).size();
|
||||
}
|
||||
}
|
||||
|
||||
if (auto obj = ScreenPlayUtil::openJsonFileToObject(absoluteFilePath)) {
|
||||
|
||||
@ -284,7 +283,7 @@ QVariantMap InstalledListModel::get(const QString& folderName) const
|
||||
map.insert("m_publishedFileID", item.m_publishedFileID);
|
||||
map.insert("m_isNew", item.m_isNew);
|
||||
map.insert("m_lastModified", item.m_lastModified);
|
||||
map.insert("m_Size",item.m_Size);
|
||||
map.insert("m_Size", item.m_sizeBytes);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ struct ProjectFile {
|
||||
m_searchType = ScreenPlayUtil::getSearchTypeFromInstalledType(m_type);
|
||||
m_isNew = isNew;
|
||||
m_lastModified = lastModified;
|
||||
m_Size = sizeBytes;
|
||||
m_sizeBytes = sizeBytes;
|
||||
}
|
||||
|
||||
ProjectFile() { }
|
||||
@ -142,6 +142,6 @@ struct ProjectFile {
|
||||
SearchType::SearchType m_searchType = SearchType::SearchType::All;
|
||||
bool m_isNew = false;
|
||||
QDateTime m_lastModified;
|
||||
int m_Size;
|
||||
int m_sizeBytes;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user