digiKam
ShowFoto::ShowfotoItemSortSettings Class Reference

Public Types

enum  CategorizationMode { NoCategories , CategoryByFolder , CategoryByFormat }
 
enum  SortOrder { AscendingOrder = Qt::AscendingOrder , DescendingOrder = Qt::DescendingOrder , DefaultOrder }
 
enum  SortRole { SortByCreationDate , SortByFileName , SortByFileSize }
 

Public Member Functions

int compare (const ShowfotoItemInfo &left, const ShowfotoItemInfo &right) const
 
int compare (const ShowfotoItemInfo &left, const ShowfotoItemInfo &right, SortRole sortRole) const
 
int compareCategories (const ShowfotoItemInfo &left, const ShowfotoItemInfo &right) const
 
bool isCategorized () const
 
bool lessThan (const QVariant &left, const QVariant &right) const
 
bool lessThan (const ShowfotoItemInfo &left, const ShowfotoItemInfo &right) const
 
bool operator== (const ShowfotoItemSortSettings &other) const
 
void setCategorizationMode (CategorizationMode mode)
 — Categories ------------— More...
 
void setCategorizationSortOrder (SortOrder order)
 
void setSortOrder (SortOrder order)
 
void setSortRole (SortRole role)
 Showfoto Items Sorting ------------— More...
 
 ShowfotoItemSortSettings ()
 
 ~ShowfotoItemSortSettings ()
 

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)
 

Public Attributes

Qt::CaseSensitivity categorizationCaseSensitivity
 
CategorizationMode categorizationMode
 
SortOrder categorizationSortOrder
 
Qt::SortOrder currentCategorizationSortOrder
 Only Ascending or Descending, never be DefaultOrder. More...
 
Qt::SortOrder currentSortOrder
 
Qt::CaseSensitivity sortCaseSensitivity
 
SortOrder sortOrder
 
SortRole sortRole
 

Member Enumeration Documentation

◆ CategorizationMode

Enumerator
NoCategories 
CategoryByFolder 
CategoryByFormat 

◆ SortOrder

Enumerator
AscendingOrder 
DescendingOrder 
DefaultOrder 

sort order depends on the chosen sort role

◆ SortRole

Enumerator
SortByCreationDate 
SortByFileName 
SortByFileSize 

Constructor & Destructor Documentation

◆ ShowfotoItemSortSettings()

ShowFoto::ShowfotoItemSortSettings::ShowfotoItemSortSettings ( )

◆ ~ShowfotoItemSortSettings()

ShowFoto::ShowfotoItemSortSettings::~ShowfotoItemSortSettings ( )

Member Function Documentation

◆ compare() [1/2]

int ShowFoto::ShowfotoItemSortSettings::compare ( const ShowfotoItemInfo left,
const ShowfotoItemInfo right 
) const

Compares the showfotoItemInfos 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 ShowFoto::ShowfotoItemSortSettings::compareByOrder ( const T a,
const T b,
Qt::SortOrder  sortOrder 
)
inlinestatic

◆ compareByOrder() [2/2]

static int ShowFoto::ShowfotoItemSortSettings::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.

References sortOrder.

Referenced by compare(), compareByOrder(), lessThan(), naturalCompare(), and ShowFoto::ShowfotoStackViewItem::operator<().

◆ compareCategories()

int ShowFoto::ShowfotoItemSortSettings::compareCategories ( const ShowfotoItemInfo left,
const ShowfotoItemInfo right 
) const

Compares the categories of left and right ShowfotoItemInfos. It returns -1 if the left ShowfotoItemInfo is less than right, and 0 if both fall in the same category, and 1 if the left ShowfotoItemInfo is greater than right. Adheres to set categorization mode and current category sort order.

References categorizationCaseSensitivity, categorizationMode, CategoryByFolder, CategoryByFormat, currentCategorizationSortOrder, ShowFoto::ShowfotoItemInfo::folder, ShowFoto::ShowfotoItemInfo::mime, naturalCompare(), and NoCategories.

◆ compareValue()

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

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

Referenced by compareByOrder().

◆ defaultSortOrderForCategorizationMode()

Qt::SortOrder ShowFoto::ShowfotoItemSortSettings::defaultSortOrderForCategorizationMode ( CategorizationMode  mode)
static

◆ defaultSortOrderForSortRole()

Qt::SortOrder ShowFoto::ShowfotoItemSortSettings::defaultSortOrderForSortRole ( SortRole  role)
static

◆ isCategorized()

bool ShowFoto::ShowfotoItemSortSettings::isCategorized ( ) const
inline

◆ lessThan() [1/2]

bool ShowFoto::ShowfotoItemSortSettings::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(), and sortCaseSensitivity.

◆ lessThan() [2/2]

bool ShowFoto::ShowfotoItemSortSettings::lessThan ( const ShowfotoItemInfo left,
const ShowfotoItemInfo right 
) const

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

References compare(), SortByCreationDate, SortByFileName, and sortRole.

◆ lessThanByOrder()

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

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

References sortOrder.

◆ naturalCompare()

static int ShowFoto::ShowfotoItemSortSettings::naturalCompare ( const QString &  a,
const QString &  b,
Qt::SortOrder  sortOrder,
Qt::CaseSensitivity  caseSensitive = Qt::CaseSensitive 
)
inlinestatic

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

References compareByOrder(), and sortOrder.

Referenced by compare(), compareCategories(), lessThan(), and ShowFoto::ShowfotoStackViewItem::operator<().

◆ operator==()

bool ShowFoto::ShowfotoItemSortSettings::operator== ( const ShowfotoItemSortSettings other) const

◆ setCategorizationMode()

void ShowFoto::ShowfotoItemSortSettings::setCategorizationMode ( CategorizationMode  mode)

◆ setCategorizationSortOrder()

void ShowFoto::ShowfotoItemSortSettings::setCategorizationSortOrder ( SortOrder  order)

◆ setSortOrder()

void ShowFoto::ShowfotoItemSortSettings::setSortOrder ( SortOrder  order)

◆ setSortRole()

void ShowFoto::ShowfotoItemSortSettings::setSortRole ( SortRole  role)

Showfoto Items Sorting ------------—

References currentSortOrder, DefaultOrder, defaultSortOrderForSortRole(), sortOrder, and sortRole.

Member Data Documentation

◆ categorizationCaseSensitivity

Qt::CaseSensitivity ShowFoto::ShowfotoItemSortSettings::categorizationCaseSensitivity

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

◆ categorizationMode

CategorizationMode ShowFoto::ShowfotoItemSortSettings::categorizationMode

◆ categorizationSortOrder

SortOrder ShowFoto::ShowfotoItemSortSettings::categorizationSortOrder

◆ currentCategorizationSortOrder

Qt::SortOrder ShowFoto::ShowfotoItemSortSettings::currentCategorizationSortOrder

Only Ascending or Descending, never be DefaultOrder.

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

◆ currentSortOrder

Qt::SortOrder ShowFoto::ShowfotoItemSortSettings::currentSortOrder

◆ sortCaseSensitivity

Qt::CaseSensitivity ShowFoto::ShowfotoItemSortSettings::sortCaseSensitivity

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

◆ sortOrder

SortOrder ShowFoto::ShowfotoItemSortSettings::sortOrder

◆ sortRole

SortRole ShowFoto::ShowfotoItemSortSettings::sortRole

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