From 064ef4cfeb7307cae1cfbc640ca3c47e8032f365 Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Sat, 23 May 2020 17:33:01 +0200 Subject: Update IFileTree implementations following uibase changes. --- src/archivefiletree.cpp | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) (limited to 'src/archivefiletree.cpp') diff --git a/src/archivefiletree.cpp b/src/archivefiletree.cpp index 0b715f4f..6ba06924 100644 --- a/src/archivefiletree.cpp +++ b/src/archivefiletree.cpp @@ -33,23 +33,11 @@ class ArchiveFileEntry : public virtual FileTreeEntry { public: /** - * @brief Create a new entry corresponding to a file. + * @brief Create a new entry. * - * @param parent The tree containing this file. - * @param name The name of this file. - * @param index The index of the file in the archive. - * @param time The modification time of this file. - */ - ArchiveFileEntry(std::shared_ptr parent, QString name, int index, QDateTime time) : - FileTreeEntry(parent, name, time), m_Index(index) { - } - - /** - * @brief Create a new entry corresponding to a directory. - * - * @param parent The tree containing this directory. - * @param name The name of this directory. - * @param index The index of the directory in the archive, or -1. + * @param parent The tree containing this entry. + * @param name The name of this entry. + * @param index The index of the entry in the archive. */ ArchiveFileEntry(std::shared_ptr parent, QString name, int index) : FileTreeEntry(parent, name), m_Index(index) { @@ -98,7 +86,7 @@ public: // Overrides: /** * @override */ - std::shared_ptr addFile(QString path, QDateTime time = QDateTime()) override { + std::shared_ptr addFile(QString path) override { // Cannot add file to an archive. throw UnsupportedOperationException(QObject::tr("Cannot create file within an archive.")); } @@ -159,7 +147,7 @@ protected: return std::make_shared(parent, name, -1, std::vector{}); } - virtual void doPopulate(std::shared_ptr parent, std::vector>& entries) const override { + virtual bool doPopulate(std::shared_ptr parent, std::vector>& entries) const override { // Sort by name: std::sort(std::begin(m_Files), std::end(m_Files), @@ -200,7 +188,7 @@ protected: // If it is not a directory, then it is a file in directly under this tree: if (!std::get<1>(p)) { entries.push_back( - std::make_shared(parent, currentName, std::get<2>(p), QDateTime())); + std::make_shared(parent, currentName, std::get<2>(p))); currentName = ""; } else { @@ -219,6 +207,9 @@ protected: if (currentName != "") { entries.push_back(std::make_shared(parent, currentName, currentIndex, std::move(currentFiles))); } + + // Let the parent class sort the entries: + return false; } virtual std::shared_ptr doClone() const override { -- cgit v1.3.1