From 0ecad71d2e577ec8846cfef12cbf05a20ee5395b Mon Sep 17 00:00:00 2001 From: Don Honerbrink Date: Wed, 11 Mar 2015 17:01:48 -0500 Subject: [PATCH] Sort by full title alphabetically. --- RetroFE/Source/Collection/CollectionInfo.cpp | 2 +- RetroFE/Source/Collection/Item.cpp | 7 +++++++ RetroFE/Source/Collection/Item.h | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/RetroFE/Source/Collection/CollectionInfo.cpp b/RetroFE/Source/Collection/CollectionInfo.cpp index c1e8752..3d0b75d 100644 --- a/RetroFE/Source/Collection/CollectionInfo.cpp +++ b/RetroFE/Source/Collection/CollectionInfo.cpp @@ -91,7 +91,7 @@ std::vector *CollectionInfo::GetItems() bool CollectionInfo::ItemIsLess(Item const *lhs, Item const *rhs) { - return lhs->GetLCTitle() < rhs->GetLCTitle(); + return lhs->GetLCFullTitle() < rhs->GetLCFullTitle(); } void CollectionInfo::SortItems() diff --git a/RetroFE/Source/Collection/Item.cpp b/RetroFE/Source/Collection/Item.cpp index 0c46ad8..bb8dba3 100644 --- a/RetroFE/Source/Collection/Item.cpp +++ b/RetroFE/Source/Collection/Item.cpp @@ -114,6 +114,11 @@ const std::string& Item::GetLCTitle() const return LCTitle; } +const std::string& Item::GetLCFullTitle() const +{ + return LCFullTitle; +} + void Item::SetTitle(const std::string& title) { Title = title; @@ -149,6 +154,8 @@ const std::string& Item::GetFullTitle() const void Item::SetFullTitle(const std::string& fulltitle) { FullTitle = fulltitle; + LCFullTitle = fulltitle; + std::transform(LCFullTitle.begin(), LCFullTitle.end(), LCFullCTitle.begin(), ::tolower); } const std::string& Item::GetCloneOf() const diff --git a/RetroFE/Source/Collection/Item.h b/RetroFE/Source/Collection/Item.h index f08cecc..b157592 100644 --- a/RetroFE/Source/Collection/Item.h +++ b/RetroFE/Source/Collection/Item.h @@ -45,6 +45,7 @@ public: bool IsLeaf() const; void SetIsLeaf(bool leaf); const std::string& GetFullTitle() const; + const std::string& GetLCFullTitle() const; void SetFullTitle(const std::string& fulltitle); const std::string& GetCloneOf() const; void SetCloneOf(const std::string& cloneOf); @@ -56,6 +57,7 @@ private: std::string Title; std::string LCTitle; std::string FullTitle; + std::string LCFullTitle; std::string Year; std::string Manufacturer; std::string Genre;