digiKam
Digikam::ItemSortSettings Class Reference

Public Types

enum  CategorizationMode {
  NoCategories , OneCategory , CategoryByAlbum , CategoryByFormat ,
  CategoryByMonth , CategoryByFaces
}
 
enum  SortOrder { AscendingOrder = Qt::AscendingOrder , DescendingOrder = Qt::DescendingOrder , DefaultOrder }
 
enum  SortRole {
  SortByFileName , SortByFilePath , SortByCreationDate , SortByModificationDate ,
  SortByFileSize , SortByRating , SortByImageSize , SortByAspectRatio ,
  SortByFaces , SortBySimilarity , SortByManualOrderAndName , SortByManualOrderAndDate
}
 

Public Member Functions

int compare (const ItemInfo &left, const ItemInfo &right) const
 
int compare (const ItemInfo &left, const ItemInfo &right, SortRole sortRole) const
 — Image Sorting — More...
 
int compareCategories (const ItemInfo &left, const ItemInfo &right, const FaceTagsIface &leftFace, const FaceTagsIface &rightFace) const
 
bool isCategorized () const
 
 ItemSortSettings ()
 
bool lessThan (const ItemInfo &left, const ItemInfo &right) const
 
bool lessThan (const QVariant &left, const QVariant &right) const
 
bool operator== (const ItemSortSettings &other) const
 
void setCategorizationMode (CategorizationMode mode)
 — Categories — More...
 
void setCategorizationSortOrder (SortOrder order)
 
void setSortOrder (SortOrder order)
 
void setSortRole (SortRole role)
 
void setStringTypeNatural (bool natural)
 
DatabaseFields::Set watchFlags () const
 — Change notification — More...
 

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)
 — Utilities — More...
 
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
 
CategorizationMode categorizationMode
 
SortOrder categorizationSortOrder
 
Qt::SortOrder currentCategorizationSortOrder
 Only Ascending or Descending, never DefaultOrder. More...
 
Qt::SortOrder currentSortOrder
 
Qt::CaseSensitivity sortCaseSensitivity
 
SortOrder sortOrder
 
SortRole sortRole
 
bool strTypeNatural
 

Member Enumeration Documentation

◆ CategorizationMode

Enumerator
NoCategories 

categorization switched off

OneCategory 

all items in one global category

CategoryByAlbum 
CategoryByFormat 
CategoryByMonth 
CategoryByFaces 

◆ SortOrder

Enumerator
AscendingOrder 
DescendingOrder 
DefaultOrder 

sort order depends on the chosen sort role

◆ SortRole

Enumerator
SortByFileName 
SortByFilePath 
SortByCreationDate 
SortByModificationDate 
SortByFileSize 
SortByRating 
SortByImageSize 

pixel number

SortByAspectRatio 

width / height * 100000

SortByFaces 

count of unconfirmed faces

SortBySimilarity 
SortByManualOrderAndName 
SortByManualOrderAndDate 

Constructor & Destructor Documentation

◆ ItemSortSettings()

Digikam::ItemSortSettings::ItemSortSettings ( )
explicit

Member Function Documentation

◆ compare() [1/2]

int Digikam::ItemSortSettings::compare ( const ItemInfo left,
const ItemInfo right 
) const

Compares the ItemInfos 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 sortRole.

Referenced by lessThan().

◆ compare() [2/2]

◆ compareByOrder() [1/2]

template<typename T >
static int Digikam::ItemSortSettings::compareByOrder ( const T a,
const T b,
Qt::SortOrder  sortOrder 
)
inlinestatic

◆ compareByOrder() [2/2]

static int Digikam::ItemSortSettings::compareByOrder ( int  compareResult,
Qt::SortOrder  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.

Referenced by compare(), compareCategories(), Digikam::ItemAlbumFilterModel::compareInfosCategories(), and lessThan().

◆ compareCategories()

int Digikam::ItemSortSettings::compareCategories ( const ItemInfo left,
const ItemInfo right,
const FaceTagsIface leftFace,
const FaceTagsIface rightFace 
) const

◆ compareValue()

template<typename T >
static int Digikam::ItemSortSettings::compareValue ( const T a,
const T b 
)
inlinestatic

Returns the usual compare result of -1, 0, or 1 for lessThan, equals and greaterThan.

◆ defaultSortOrderForCategorizationMode()

Qt::SortOrder Digikam::ItemSortSettings::defaultSortOrderForCategorizationMode ( CategorizationMode  mode)
static

◆ defaultSortOrderForSortRole()

◆ isCategorized()

bool Digikam::ItemSortSettings::isCategorized ( ) const
inline

◆ lessThan() [1/2]

bool Digikam::ItemSortSettings::lessThan ( const ItemInfo left,
const ItemInfo right 
) const

Returns true if left is less than right. Adheres to current sort role and sort order.

References compare(), SortByCreationDate, SortByFileName, SortByFilePath, SortByFileSize, SortByManualOrderAndDate, SortByManualOrderAndName, SortByModificationDate, SortBySimilarity, and sortRole.

◆ lessThan() [2/2]

bool Digikam::ItemSortSettings::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. Use for extraValue, if necessary.

References compareByOrder(), currentSortOrder, naturalCompare(), sortCaseSensitivity, and strTypeNatural.

◆ lessThanByOrder()

template<typename T >
static bool Digikam::ItemSortSettings::lessThanByOrder ( const T a,
const T b,
Qt::SortOrder  sortOrder 
)
inlinestatic

— Utilities —

Returns a < b if sortOrder is Ascending, or b < a if order is descending.

Referenced by compareCategories().

◆ naturalCompare()

static int Digikam::ItemSortSettings::naturalCompare ( const QString &  a,
const QString &  b,
Qt::SortOrder  sortOrder,
Qt::CaseSensitivity  caseSensitive = Qt::CaseSensitive,
bool  natural = true 
)
inlinestatic

Compares the two string by natural comparison and adheres to given sort order

References Digikam::ItemSortCollator::instance(), and Digikam::ItemSortCollator::itemCompare().

Referenced by compare(), compareCategories(), Digikam::ItemAlbumFilterModel::compareInfosCategories(), and lessThan().

◆ operator==()

bool Digikam::ItemSortSettings::operator== ( const ItemSortSettings other) const

◆ setCategorizationMode()

void Digikam::ItemSortSettings::setCategorizationMode ( CategorizationMode  mode)

◆ setCategorizationSortOrder()

void Digikam::ItemSortSettings::setCategorizationSortOrder ( SortOrder  order)

◆ setSortOrder()

void Digikam::ItemSortSettings::setSortOrder ( SortOrder  order)

◆ setSortRole()

void Digikam::ItemSortSettings::setSortRole ( SortRole  role)

◆ setStringTypeNatural()

void Digikam::ItemSortSettings::setStringTypeNatural ( bool  natural)

References strTypeNatural.

◆ watchFlags()

Member Data Documentation

◆ categorizationCaseSensitivity

Qt::CaseSensitivity Digikam::ItemSortSettings::categorizationCaseSensitivity

Referenced by compareCategories(), and operator==().

◆ categorizationMode

CategorizationMode Digikam::ItemSortSettings::categorizationMode

◆ categorizationSortOrder

SortOrder Digikam::ItemSortSettings::categorizationSortOrder

◆ currentCategorizationSortOrder

Qt::SortOrder Digikam::ItemSortSettings::currentCategorizationSortOrder

Only Ascending or Descending, never DefaultOrder.

Referenced by compareCategories(), setCategorizationMode(), and setCategorizationSortOrder().

◆ currentSortOrder

Qt::SortOrder Digikam::ItemSortSettings::currentSortOrder

◆ sortCaseSensitivity

Qt::CaseSensitivity Digikam::ItemSortSettings::sortCaseSensitivity

Referenced by compare(), lessThan(), and operator==().

◆ sortOrder

SortOrder Digikam::ItemSortSettings::sortOrder

◆ sortRole

SortRole Digikam::ItemSortSettings::sortRole

◆ strTypeNatural

bool Digikam::ItemSortSettings::strTypeNatural

The documentation for this class was generated from the following files: