File indexing completed on 2024-04-28 15:39:55
0001 // SPDX-FileCopyrightText: 2003-2023 The KPhotoAlbum Development Team 0002 // 0003 // SPDX-License-Identifier: GPL-2.0-or-later 0004 0005 #pragma once 0006 0007 #include "CategoryPtr.h" 0008 #include <QList> 0009 0010 namespace DB 0011 { 0012 class FileReader; 0013 0014 /** 0015 Just as each category has a most-recently-used sorting, 0016 that makes it possible to see the most likely hit in the List boxes in the annotation dialog, 0017 we also keep a global most-recent-used list across all categories, so that you can 0018 get a sorting like People/Jesper, Places/Las Vegas, People Jim 0019 This is what this class encapsulate. 0020 0021 When an item has been used for tagging, it is pushed to the front of the list using 0022 \ref pushToFront. 0023 0024 To get the global sort order for use for completion, call \ref completeSortOrder. 0025 0026 On her other hand, to save the sort order, only those ever used should be retrieved, 0027 which is possible using \ref modifiedSortOrder 0028 */ 0029 class GlobalCategorySortOrder 0030 { 0031 public: 0032 void pushToFront(const QString &category, const QString &value); 0033 0034 struct Item { 0035 QString category; 0036 QString item; 0037 friend bool operator==(const Item &x, const Item &y); 0038 friend size_t qHash(const Item &item); 0039 }; 0040 0041 QList<Item> completeSortOrder(); 0042 QList<Item> modifiedSortOrder(); 0043 0044 private: 0045 friend class DB::FileReader; 0046 QList<Item> m_sortOrder; 0047 }; 0048 0049 } // namespace DB