![]() |
digiKam
|
#include <camitemsortsettings.h>
Public Types | |
enum | CategorizationMode { NoCategories , CategoryByFolder , CategoryByFormat , CategoryByDate } |
enum | SortOrder { AscendingOrder = Qt::AscendingOrder , DescendingOrder = Qt::DescendingOrder , DefaultOrder } |
enum | SortRole { SortByFileName , SortByFilePath , SortByCreationDate , SortByFileSize , SortByDownloadState , SortByRating } |
Public Member Functions | |
CamItemSortSettings ()=default | |
int | compare (const CamItemInfo &left, const CamItemInfo &right) const |
int | compare (const CamItemInfo &left, const CamItemInfo &right, SortRole sortRole) const |
int | compareCategories (const CamItemInfo &left, const CamItemInfo &right) const |
bool | isCategorized () const |
bool | lessThan (const CamItemInfo &left, const CamItemInfo &right) const |
bool | lessThan (const QVariant &left, const QVariant &right) const |
bool | operator== (const CamItemSortSettings &other) const |
void | setCategorizationMode (CategorizationMode mode) |
void | setCategorizationSortOrder (SortOrder order) |
void | setSortOrder (SortOrder order) |
void | setSortRole (SortRole role) |
void | setStringTypeNatural (bool natural) |
~CamItemSortSettings ()=default | |
Static Public Member Functions | |
template<typename T > | |
static int | compareByOrder (const T &a, const T &b, Qt::SortOrder sortOrder) |
static int | compareByOrder (int compareResult, Qt::SortOrder sortOrder) |
template<typename T > | |
static int | compareValue (const T &a, const T &b) |
static Qt::SortOrder | defaultSortOrderForCategorizationMode (CategorizationMode mode) |
static Qt::SortOrder | defaultSortOrderForSortRole (SortRole role) |
template<typename T > | |
static bool | lessThanByOrder (const T &a, const T &b, Qt::SortOrder sortOrder) |
static int | naturalCompare (const QString &a, const QString &b, Qt::SortOrder sortOrder, Qt::CaseSensitivity caseSensitive=Qt::CaseSensitive, bool natural=true) |
Public Attributes | |
Qt::CaseSensitivity | categorizationCaseSensitivity = Qt::CaseSensitive |
CategorizationMode | categorizationMode = NoCategories |
SortOrder | categorizationSortOrder = DefaultOrder |
Qt::SortOrder | currentCategorizationSortOrder = Qt::AscendingOrder |
Only Ascending or Descending, never be DefaultOrder. | |
Qt::SortOrder | currentSortOrder = Qt::AscendingOrder |
Qt::CaseSensitivity | sortCaseSensitivity = Qt::CaseSensitive |
SortOrder | sortOrder = DefaultOrder |
Camera Items Sorting. | |
SortRole | sortRole = SortByFileName |
bool | strTypeNatural = true |
|
default |
|
default |
int Digikam::CamItemSortSettings::compare | ( | const CamItemInfo & | left, |
const CamItemInfo & | right | ||
) | const |
Compares the camItemInfos left and right. Return -1 if left is less than right, 1 if left is greater than right, and 0 if left equals right comparing the current sort role's value. Adheres to set sort role and sort order.
References compare(), and sortRole.
Referenced by compare(), and lessThan().
int Digikam::CamItemSortSettings::compare | ( | const CamItemInfo & | left, |
const CamItemInfo & | right, | ||
SortRole | sortRole | ||
) | const |
References compareByOrder(), Digikam::CamItemInfo::ctime, currentSortOrder, Digikam::CamItemInfo::downloaded, Digikam::CamItemInfo::name, naturalCompare(), Digikam::CamItemInfo::rating, Digikam::CamItemInfo::size, SortByCreationDate, SortByDownloadState, SortByFileName, SortByFilePath, SortByFileSize, SortByRating, sortCaseSensitivity, strTypeNatural, and Digikam::CamItemInfo::url().
|
inlinestatic |
References compareByOrder(), compareValue(), and sortOrder.
|
inlinestatic |
Takes a typical result from a compare method (0 is equal, -1 is less than, 1 is greater than) and applies the given sort order to it.
References sortOrder.
Referenced by compare(), compareByOrder(), compareCategories(), lessThan(), and naturalCompare().
int Digikam::CamItemSortSettings::compareCategories | ( | const CamItemInfo & | left, |
const CamItemInfo & | right | ||
) | const |
Compares the categories of left and right camItemInfos. It returns -1 if the left camItemInfo is less than right, and 0 if both fall in the same category, and 1 if the left camItemInfo is greater than right. Adheres to set categorization mode and current category sort order.
References categorizationCaseSensitivity, categorizationMode, CategoryByDate, CategoryByFolder, CategoryByFormat, compareByOrder(), Digikam::CamItemInfo::ctime, currentCategorizationSortOrder, Digikam::CamItemInfo::folder, Digikam::CamItemInfo::mime, naturalCompare(), NoCategories, and strTypeNatural.
|
inlinestatic |
Returns the usual compare result of -1, 0, or 1 for lessThan, equals and greaterThan.
Referenced by compareByOrder().
|
static |
References CategoryByDate, CategoryByFolder, CategoryByFormat, and NoCategories.
Referenced by setCategorizationMode(), and setCategorizationSortOrder().
|
static |
References SortByCreationDate, SortByDownloadState, SortByFileName, SortByFilePath, SortByFileSize, and SortByRating.
Referenced by setSortOrder(), and setSortRole().
|
inline |
References categorizationMode, and CategoryByFolder.
bool Digikam::CamItemSortSettings::lessThan | ( | const CamItemInfo & | left, |
const CamItemInfo & | right | ||
) | const |
Returns true if left is less than right. Adheres to current sort role and sort order.
References compare(), SortByCreationDate, SortByDownloadState, SortByFileName, SortByFilePath, SortByFileSize, SortByRating, and sortRole.
bool Digikam::CamItemSortSettings::lessThan | ( | const QVariant & | left, |
const QVariant & | right | ||
) | const |
Returns true if left QVariant is less than right. Adheres to current sort role and sort order.
References compareByOrder(), currentSortOrder, naturalCompare(), sortCaseSensitivity, and strTypeNatural.
|
inlinestatic |
Returns a < b if sortOrder is Ascending, or b < a if order is descending
References sortOrder.
|
inlinestatic |
Compares the two string by natural comparison and adheres to given sort order
References compareByOrder(), Digikam::ItemSortCollator::instance(), Digikam::ItemSortCollator::itemCompare(), and sortOrder.
Referenced by compare(), compareCategories(), and lessThan().
bool Digikam::CamItemSortSettings::operator== | ( | const CamItemSortSettings & | other | ) | const |
void Digikam::CamItemSortSettings::setCategorizationMode | ( | CategorizationMode | mode | ) |
void Digikam::CamItemSortSettings::setCategorizationSortOrder | ( | SortOrder | order | ) |
References categorizationMode, categorizationSortOrder, currentCategorizationSortOrder, DefaultOrder, and defaultSortOrderForCategorizationMode().
Referenced by setSortOrder().
void Digikam::CamItemSortSettings::setSortOrder | ( | SortOrder | order | ) |
References currentSortOrder, DefaultOrder, defaultSortOrderForSortRole(), setCategorizationSortOrder(), sortOrder, and sortRole.
void Digikam::CamItemSortSettings::setSortRole | ( | SortRole | role | ) |
References currentSortOrder, DefaultOrder, defaultSortOrderForSortRole(), sortOrder, and sortRole.
void Digikam::CamItemSortSettings::setStringTypeNatural | ( | bool | natural | ) |
References strTypeNatural.
Qt::CaseSensitivity Digikam::CamItemSortSettings::categorizationCaseSensitivity = Qt::CaseSensitive |
Referenced by compareCategories(), and operator==().
CategorizationMode Digikam::CamItemSortSettings::categorizationMode = NoCategories |
Referenced by compareCategories(), isCategorized(), operator==(), setCategorizationMode(), and setCategorizationSortOrder().
SortOrder Digikam::CamItemSortSettings::categorizationSortOrder = DefaultOrder |
Referenced by operator==(), setCategorizationMode(), and setCategorizationSortOrder().
Qt::SortOrder Digikam::CamItemSortSettings::currentCategorizationSortOrder = Qt::AscendingOrder |
Only Ascending or Descending, never be DefaultOrder.
Referenced by compareCategories(), setCategorizationMode(), and setCategorizationSortOrder().
Qt::SortOrder Digikam::CamItemSortSettings::currentSortOrder = Qt::AscendingOrder |
Referenced by compare(), lessThan(), setSortOrder(), and setSortRole().
Qt::CaseSensitivity Digikam::CamItemSortSettings::sortCaseSensitivity = Qt::CaseSensitive |
Referenced by compare(), lessThan(), and operator==().
SortOrder Digikam::CamItemSortSettings::sortOrder = DefaultOrder |
Camera Items Sorting.
Referenced by compareByOrder(), compareByOrder(), lessThanByOrder(), naturalCompare(), operator==(), setSortOrder(), and setSortRole().
SortRole Digikam::CamItemSortSettings::sortRole = SortByFileName |
Referenced by compare(), lessThan(), operator==(), setSortOrder(), and setSortRole().
bool Digikam::CamItemSortSettings::strTypeNatural = true |
Referenced by compare(), compareCategories(), lessThan(), and setStringTypeNatural().