File indexing completed on 2024-05-12 17:22:03
0001 /* 0002 SPDX-FileCopyrightText: 2017-2022 Krusader Krew <https://krusader.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KRVIEWPROPERTIES_H 0008 #define KRVIEWPROPERTIES_H 0009 0010 #include "../FileSystem/krquery.h" 0011 #include "../Filter/filtersettings.h" 0012 0013 // QtCore 0014 #include <QStringList> 0015 0016 class FilterSettings; 0017 class KrQuery; 0018 0019 /** 0020 * This class is an interface class between KrView and KrViewItem 0021 * 0022 * In order for KrViewItem to be as independent as possible, KrView holds 0023 * an instance of this class, and fills it with the correct data. A reference 0024 * to this should be given to each KrViewItem, which then queries it for 0025 * information regarding how things should be displayed in the current view. 0026 * 0027 * Every property that the item needs to know about the view must be here! 0028 */ 0029 class KrViewProperties 0030 { 0031 public: 0032 enum PropertyType { 0033 NoProperty = 0x0, 0034 PropIconSize = 0x1, 0035 PropShowPreviews = 0x2, 0036 PropSortMode = 0x4, 0037 PropColumns = 0x8, 0038 PropFilter = 0x10, 0039 AllProperties = PropIconSize | PropShowPreviews | PropSortMode | PropColumns | PropFilter 0040 }; 0041 enum ColumnType { 0042 NoColumn = -1, 0043 Name = 0x0, 0044 Ext = 0x1, 0045 Size = 0x2, 0046 Type = 0x3, 0047 Modified = 0x4, 0048 Permissions = 0x5, 0049 KrPermissions = 0x6, 0050 Owner = 0x7, 0051 Group = 0x8, 0052 Changed = 0x9, 0053 Accessed = 0xa, 0054 MAX_COLUMNS = 0x0b 0055 }; 0056 enum SortOptions { Descending = 0x200, DirsFirst = 0x400, IgnoreCase = 0x800, AlwaysSortDirsByName = 0x1000, LocaleAwareSort = 0x2000 }; 0057 enum SortMethod { Alphabetical = 0x1, AlphabeticalNumbers = 0x2, CharacterCode = 0x4, CharacterCodeNumbers = 0x8, Krusader = 0x10 }; 0058 enum FilterSpec { Dirs = 0x1, Files = 0x2, All = 0x3, Custom = 0x4 }; 0059 0060 KrViewProperties(bool displayIcons, 0061 bool numericPermissions, 0062 SortOptions sortOptions, 0063 SortMethod sortMethod, 0064 bool humanReadableSize, 0065 bool localeAwareCompareIsCaseSensitive, 0066 QStringList atomicExtensions); 0067 0068 const bool numericPermissions; // show full permission column as octal numbers 0069 const bool displayIcons; // true if icons should be displayed in this view 0070 0071 ColumnType sortColumn; 0072 SortOptions sortOptions; 0073 0074 const SortMethod sortMethod; // sort method for names and extensions 0075 0076 FilterSpec filter; // what items to show (all, custom, exec) 0077 KrQuery filterMask; // what items to show (*.cpp, *.h etc) 0078 FilterSettings filterSettings; 0079 bool filterApplysToDirs; 0080 0081 const bool localeAwareCompareIsCaseSensitive; // mostly, it is not! depends on LC_COLLATE 0082 const bool humanReadableSize; // display size as KB, MB or just as a long number 0083 // list of strings, which will be treated as one extension. Must start with a dot. 0084 const QStringList atomicExtensions; 0085 int numberOfColumns; // the number of columns in the brief view 0086 }; 0087 0088 #endif // KRVIEWPROPERTIES_H