1 /***************************************************************************** 2 * Copyright (C) 2017-2019 Krusader Krew [https://krusader.org] * 3 * * 4 * This file is part of Krusader [https://krusader.org]. * 5 * * 6 * Krusader is free software: you can redistribute it and/or modify * 7 * it under the terms of the GNU General Public License as published by * 8 * the Free Software Foundation, either version 2 of the License, or * 9 * (at your option) any later version. * 10 * * 11 * Krusader is distributed in the hope that it will be useful, * 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 14 * GNU General Public License for more details. * 15 * * 16 * You should have received a copy of the GNU General Public License * 17 * along with Krusader. If not, see [http://www.gnu.org/licenses/]. * 18 *****************************************************************************/ 19 20 #ifndef KRVIEWPROPERTIES_H 21 #define KRVIEWPROPERTIES_H 22 23 #include "../Filter/filtersettings.h" 24 #include "../FileSystem/krquery.h" 25 26 // QtCore 27 #include <QStringList> 28 29 class FilterSettings; 30 class KRQuery; 31 32 /** 33 * This class is an interface class between KrView and KrViewItem 34 * 35 * In order for KrViewItem to be as independent as possible, KrView holds 36 * an instance of this class, and fills it with the correct data. A reference 37 * to this should be given to each KrViewItem, which then queries it for 38 * information regarding how things should be displayed in the current view. 39 * 40 * Every property that the item needs to know about the view must be here! 41 */ 42 class KrViewProperties 43 { 44 public: 45 enum PropertyType { 46 NoProperty = 0x0, 47 PropIconSize = 0x1, 48 PropShowPreviews = 0x2, 49 PropSortMode = 0x4, 50 PropColumns = 0x8, 51 PropFilter = 0x10, 52 AllProperties = PropIconSize | PropShowPreviews | PropSortMode | PropColumns | PropFilter 53 }; 54 enum ColumnType { 55 NoColumn = -1, 56 Name = 0x0, 57 Ext = 0x1, 58 Size = 0x2, 59 Type = 0x3, 60 Modified = 0x4, 61 Permissions = 0x5, 62 KrPermissions = 0x6, 63 Owner = 0x7, 64 Group = 0x8, 65 Changed = 0x9, 66 Accessed = 0xa, 67 MAX_COLUMNS = 0x0b 68 }; 69 enum SortOptions { 70 Descending = 0x200, 71 DirsFirst = 0x400, 72 IgnoreCase = 0x800, 73 AlwaysSortDirsByName = 0x1000, 74 LocaleAwareSort = 0x2000 75 }; 76 enum SortMethod { 77 Alphabetical = 0x1, 78 AlphabeticalNumbers = 0x2, 79 CharacterCode = 0x4, 80 CharacterCodeNumbers = 0x8, 81 Krusader = 0x10 82 }; 83 enum FilterSpec { Dirs = 0x1, Files = 0x2, All = 0x3, Custom = 0x4 }; 84 85 KrViewProperties(bool displayIcons, bool numericPermissions, SortOptions sortOptions, 86 SortMethod sortMethod, bool humanReadableSize, 87 bool localeAwareCompareIsCaseSensitive, QStringList atomicExtensions); 88 89 const bool numericPermissions; // show full permission column as octal numbers 90 const bool displayIcons; // true if icons should be displayed in this view 91 92 ColumnType sortColumn; 93 SortOptions sortOptions; 94 95 const SortMethod sortMethod; // sort method for names and extensions 96 97 FilterSpec filter; // what items to show (all, custom, exec) 98 KRQuery filterMask; // what items to show (*.cpp, *.h etc) 99 FilterSettings filterSettings; 100 bool filterApplysToDirs; 101 102 const bool localeAwareCompareIsCaseSensitive; // mostly, it is not! depends on LC_COLLATE 103 const bool humanReadableSize; // display size as KB, MB or just as a long number 104 // list of strings, which will be treated as one extension. Must start with a dot. 105 const QStringList atomicExtensions; 106 int numberOfColumns; // the number of columns in the brief view 107 }; 108 109 #endif // KRVIEWPROPERTIES_H 110