From df126bef09298eb281a5b61fd0af063b233c09c3 Mon Sep 17 00:00:00 2001 From: Debash Bora Date: Wed, 25 Aug 2021 13:18:23 +0530 Subject: [PATCH] Changes made Till Now. --- ScreenPlay/src/installedlistmodel.cpp | 8 +++++--- ScreenPlay/src/installedlistmodel.h | 2 +- ScreenPlayUtil/inc/public/ScreenPlayUtil/projectfile.h | 8 +++++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ScreenPlay/src/installedlistmodel.cpp b/ScreenPlay/src/installedlistmodel.cpp index 5c8c29bd..9ef96071 100644 --- a/ScreenPlay/src/installedlistmodel.cpp +++ b/ScreenPlay/src/installedlistmodel.cpp @@ -144,10 +144,10 @@ QHash InstalledListModel::roleNames() const /*! \brief Append an ProjectFile to the list. */ -void InstalledListModel::append(const QJsonObject& obj, const QString& folderName, const QDateTime& lastModified) +void InstalledListModel::append(const QJsonObject& obj, const QString& folderName, const QDateTime& lastModified,const QDateTime& birthTime) { beginInsertRows(QModelIndex(), m_screenPlayFiles.size(), m_screenPlayFiles.size()); - m_screenPlayFiles.append(ProjectFile(obj, folderName, m_globalVariables->localStoragePath(), lastModified)); + m_screenPlayFiles.append(ProjectFile(obj, folderName, m_globalVariables->localStoragePath(), lastModified, birthTime)); endInsertRows(); } @@ -176,12 +176,14 @@ void InstalledListModel::loadInstalledContent() if (ScreenPlayUtil::getAvailableTypes().contains(obj->value("type").toString())) { if (ScreenPlayUtil::getAvailableTypes().contains(obj->value("type").toString(), Qt::CaseInsensitive)) { - append(*obj, item.baseName(), item.lastModified()); + append(*obj, item.baseName(), item.lastModified(),item.birthTime()); } + counter += 1; } } + } setCount(counter); emit installedLoadingFinished(); diff --git a/ScreenPlay/src/installedlistmodel.h b/ScreenPlay/src/installedlistmodel.h index d566d42d..dac72255 100644 --- a/ScreenPlay/src/installedlistmodel.h +++ b/ScreenPlay/src/installedlistmodel.h @@ -101,7 +101,7 @@ public slots: QVariantMap get(const QString& folderId) const; void loadInstalledContent(); - void append(const QJsonObject&, const QString&, const QDateTime& lastModified); + void append(const QJsonObject&, const QString&, const QDateTime& lastModified,const QDateTime& birthTime); void reset(); void init(); bool deinstallItemAt(const int index); diff --git a/ScreenPlayUtil/inc/public/ScreenPlayUtil/projectfile.h b/ScreenPlayUtil/inc/public/ScreenPlayUtil/projectfile.h index 045e45cc..3c65c6b1 100644 --- a/ScreenPlayUtil/inc/public/ScreenPlayUtil/projectfile.h +++ b/ScreenPlayUtil/inc/public/ScreenPlayUtil/projectfile.h @@ -42,6 +42,7 @@ #include #include #include +#include #include "ScreenPlayUtil/util.h" @@ -58,7 +59,8 @@ struct ProjectFile { const QJsonObject& obj, const QString& folderName, const QUrl& absolutePath, - const QDateTime& lastModified) + const QDateTime& lastModified, + const QDateTime& birthTime) { if (obj.contains("description")) @@ -100,6 +102,8 @@ struct ProjectFile { m_folderId = folderName; + + if (!obj.contains("type")) return; @@ -115,6 +119,7 @@ struct ProjectFile { } m_searchType = ScreenPlayUtil::getSearchTypeFromInstalledType(m_type); m_lastModified = lastModified; + m_birthTime = birthTime; } ProjectFile() { } @@ -136,5 +141,6 @@ struct ProjectFile { InstalledType::InstalledType m_type = InstalledType::InstalledType::Unknown; SearchType::SearchType m_searchType = SearchType::SearchType::All; QDateTime m_lastModified; + QDateTime m_birthTime; }; }