diff --git a/xbmc/Autorun.cpp b/xbmc/Autorun.cpp index 40f991a2d768a..a29a869420317 100644 --- a/xbmc/Autorun.cpp +++ b/xbmc/Autorun.cpp @@ -216,7 +216,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded CDirectory::GetDirectory(pItem->GetPath(), items, strExt); if (items.Size()) { - items.Sort(SORT_METHOD_LABEL, SORT_ORDER_ASC); + items.Sort(SORT_METHOD_LABEL, SortOrderAscending); g_playlistPlayer.ClearPlaylist(PLAYLIST_VIDEO); g_playlistPlayer.Add(PLAYLIST_VIDEO, items); g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_VIDEO); diff --git a/xbmc/FileItem.cpp b/xbmc/FileItem.cpp index 8605c8777e037..881dc44768b6b 100644 --- a/xbmc/FileItem.cpp +++ b/xbmc/FileItem.cpp @@ -57,6 +57,7 @@ #include "music/karaoke/karaokelyricsfactory.h" #include "ThumbnailCache.h" #include "utils/Mime.h" +#include "utils/CharsetConverter.h" using namespace std; using namespace XFILE; @@ -347,7 +348,7 @@ void CFileItem::Reset() delete m_pictureInfoTag; m_pictureInfoTag=NULL; m_extrainfo.Empty(); - m_specialSort = SORT_NORMALLY; + m_specialSort = SortSpecialNone; SetInvalid(); } @@ -426,7 +427,7 @@ void CFileItem::Archive(CArchive& ar) ar >> m_mimetype; ar >> m_extrainfo; ar >> temp; - m_specialSort = (SPECIAL_SORT)temp; + m_specialSort = (SortSpecial)temp; int iType; ar >> iType; @@ -465,6 +466,34 @@ void CFileItem::Serialize(CVariant& value) (*m_pictureInfoTag).Serialize(value["pictureInfoTag"]); } +void CFileItem::ToSortable(SortItem &sortable) +{ + sortable[FieldPath] = m_strPath; + sortable[FieldDate] = (m_dateTime.IsValid()) ? m_dateTime.GetAsRFC1123DateTime() : ""; + sortable[FieldSize] = (int) m_dwSize / 1000; + sortable[FieldDriveType] = m_iDriveType; + sortable[FieldStartOffset] = m_lStartOffset; + sortable[FieldStartOffset] = m_lEndOffset; + sortable[FieldProgramCount] = m_iprogramCount; + sortable[FieldBitrate] = m_dwSize; + sortable[FieldTitle] = m_strTitle; + sortable[FieldSortSpecial] = m_specialSort; + sortable[FieldFolder] = m_bIsFolder; + + // If there's ever a need to convert more properties from CGUIListItem it might be + // worth to make CGUIListItem implement ISortable as well and call it from here + sortable[FieldLabel] = GetLabel(); + + if (HasMusicInfoTag()) + GetMusicInfoTag()->ToSortable(sortable); + + if (HasVideoInfoTag()) + GetVideoInfoTag()->ToSortable(sortable); + + if (HasPictureInfoTag()) + GetPictureInfoTag()->ToSortable(sortable); +} + bool CFileItem::Exists(bool bUseCache /* = true */) const { if (m_strPath.IsEmpty() @@ -1034,7 +1063,7 @@ void CFileItem::SetLabel(const CStdString &strLabel) { m_bIsParentFolder=true; m_bIsFolder=true; - m_specialSort = SORT_ON_TOP; + m_specialSort = SortSpecialOnTop; SetLabelPreformated(true); } CGUIListItem::SetLabel(strLabel); @@ -1186,10 +1215,10 @@ void CFileItem::UpdateInfo(const CFileItem &item, bool replaceLabels /*=true*/) CFileItemList::CFileItemList() { m_fastLookup = false; - m_bIsFolder=true; - m_cacheToDisc=CACHE_IF_SLOW; - m_sortMethod=SORT_METHOD_NONE; - m_sortOrder=SORT_ORDER_NONE; + m_bIsFolder = true; + m_cacheToDisc = CACHE_IF_SLOW; + m_sortMethod = SORT_METHOD_NONE; + m_sortOrder = SortOrderNone; m_sortIgnoreFolders = false; m_replaceListing = false; } @@ -1197,9 +1226,9 @@ CFileItemList::CFileItemList() CFileItemList::CFileItemList(const CStdString& strPath) : CFileItem(strPath, true) { m_fastLookup = false; - m_cacheToDisc=CACHE_IF_SLOW; - m_sortMethod=SORT_METHOD_NONE; - m_sortOrder=SORT_ORDER_NONE; + m_cacheToDisc = CACHE_IF_SLOW; + m_sortMethod = SORT_METHOD_NONE; + m_sortOrder = SortOrderNone; m_sortIgnoreFolders = false; m_replaceListing = false; } @@ -1271,10 +1300,10 @@ void CFileItemList::Clear() CSingleLock lock(m_lock); ClearItems(); - m_sortMethod=SORT_METHOD_NONE; - m_sortOrder=SORT_ORDER_NONE; + m_sortMethod = SORT_METHOD_NONE; + m_sortOrder = SortOrderNone; m_sortIgnoreFolders = false; - m_cacheToDisc=CACHE_IF_SLOW; + m_cacheToDisc = CACHE_IF_SLOW; m_sortDetails.clear(); m_replaceListing = false; m_content.Empty(); @@ -1509,125 +1538,121 @@ void CFileItemList::FillSortFields(FILEITEMFILLFUNC func) std::for_each(m_items.begin(), m_items.end(), func); } -void CFileItemList::Sort(SORT_METHOD sortMethod, SORT_ORDER sortOrder) +void CFileItemList::Sort(SORT_METHOD sortMethod, SortOrder sortOrder) { // Already sorted? - if (sortMethod==m_sortMethod && m_sortOrder==sortOrder) + if (sortMethod == m_sortMethod && m_sortOrder == sortOrder) return; + SortBy sortBy = SortByNone; + SortAttribute sortAttributes = SortAttributeNone; + switch (sortMethod) { case SORT_METHOD_LABEL: case SORT_METHOD_LABEL_IGNORE_FOLDERS: - FillSortFields(SSortFileItem::ByLabel); - break; case SORT_METHOD_LABEL_IGNORE_THE: - FillSortFields(SSortFileItem::ByLabelNoThe); + sortBy = SortByLabel; break; case SORT_METHOD_DATE: - FillSortFields(SSortFileItem::ByDate); + sortBy = SortByDate; break; case SORT_METHOD_SIZE: - FillSortFields(SSortFileItem::BySize); + sortBy = SortBySize; break; case SORT_METHOD_BITRATE: - FillSortFields(SSortFileItem::ByBitrate); + sortBy = SortByBitrate; break; case SORT_METHOD_DRIVE_TYPE: - FillSortFields(SSortFileItem::ByDriveType); + sortBy = SortByDriveType; break; case SORT_METHOD_TRACKNUM: - FillSortFields(SSortFileItem::BySongTrackNum); + sortBy = SortByTrackNumber; break; case SORT_METHOD_EPISODE: - FillSortFields(SSortFileItem::ByEpisodeNum); + sortBy = SortByEpisodeNumber; break; case SORT_METHOD_DURATION: - FillSortFields(SSortFileItem::BySongDuration); - break; - case SORT_METHOD_TITLE_IGNORE_THE: - FillSortFields(SSortFileItem::BySongTitleNoThe); + case SORT_METHOD_VIDEO_RUNTIME: + sortBy = SortByTime; break; case SORT_METHOD_TITLE: - FillSortFields(SSortFileItem::BySongTitle); + case SORT_METHOD_TITLE_IGNORE_THE: + case SORT_METHOD_VIDEO_TITLE: + sortBy = SortByTitle; break; case SORT_METHOD_ARTIST: - FillSortFields(SSortFileItem::BySongArtist); - break; case SORT_METHOD_ARTIST_IGNORE_THE: - FillSortFields(SSortFileItem::BySongArtistNoThe); + sortBy = SortByArtist; break; case SORT_METHOD_ALBUM: - FillSortFields(SSortFileItem::BySongAlbum); - break; case SORT_METHOD_ALBUM_IGNORE_THE: - FillSortFields(SSortFileItem::BySongAlbumNoThe); + sortBy = SortByAlbum; break; case SORT_METHOD_GENRE: - FillSortFields(SSortFileItem::ByGenre); + sortBy = SortByGenre; break; case SORT_METHOD_COUNTRY: - FillSortFields(SSortFileItem::ByCountry); + sortBy = SortByCountry; break; case SORT_METHOD_DATEADDED: - FillSortFields(SSortFileItem::ByDateAdded); + sortBy = SortByDateAdded; break; case SORT_METHOD_FILE: - FillSortFields(SSortFileItem::ByFile); + sortBy = SortByFile; break; + case SORT_METHOD_SONG_RATING: case SORT_METHOD_VIDEO_RATING: - FillSortFields(SSortFileItem::ByMovieRating); - break; - case SORT_METHOD_VIDEO_TITLE: - FillSortFields(SSortFileItem::ByMovieTitle); + sortBy = SortByRating; break; case SORT_METHOD_VIDEO_SORT_TITLE: - FillSortFields(SSortFileItem::ByMovieSortTitle); - break; case SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE: - FillSortFields(SSortFileItem::ByMovieSortTitleNoThe); + sortBy = SortBySortTitle; break; case SORT_METHOD_YEAR: - FillSortFields(SSortFileItem::ByYear); + sortBy = SortByYear; break; case SORT_METHOD_PRODUCTIONCODE: - FillSortFields(SSortFileItem::ByProductionCode); + sortBy = SortByProductionCode; break; case SORT_METHOD_PROGRAM_COUNT: - case SORT_METHOD_PLAYLIST_ORDER: - // TODO: Playlist order is hacked into program count variable (not nice, but ok until 2.0) - FillSortFields(SSortFileItem::ByProgramCount); + sortBy = SortByProgramCount; break; - case SORT_METHOD_SONG_RATING: - FillSortFields(SSortFileItem::BySongRating); + case SORT_METHOD_PLAYLIST_ORDER: + sortBy = SortByPlaylistOrder; break; case SORT_METHOD_MPAA_RATING: - FillSortFields(SSortFileItem::ByMPAARating); - break; - case SORT_METHOD_VIDEO_RUNTIME: - FillSortFields(SSortFileItem::ByMovieRuntime); + sortBy = SortByMPAA; break; case SORT_METHOD_STUDIO: - FillSortFields(SSortFileItem::ByStudio); - break; case SORT_METHOD_STUDIO_IGNORE_THE: - FillSortFields(SSortFileItem::ByStudioNoThe); + sortBy = SortByStudio; break; case SORT_METHOD_FULLPATH: - FillSortFields(SSortFileItem::ByFullPath); + sortBy = SortByPath; break; case SORT_METHOD_LASTPLAYED: - FillSortFields(SSortFileItem::ByLastPlayed); + sortBy = SortByLastPlayed; break; case SORT_METHOD_PLAYCOUNT: - FillSortFields(SSortFileItem::ByPlayCount); + sortBy = SortByPlaycount; break; case SORT_METHOD_LISTENERS: - FillSortFields(SSortFileItem::ByListeners); + sortBy = SortByListeners; break; default: - break; + CLog::Log(LOGWARNING, "Unknown sort method %d", sortMethod); + return; } + + if (sortMethod == SORT_METHOD_LABEL_IGNORE_THE || + sortMethod == SORT_METHOD_TITLE_IGNORE_THE || + sortMethod == SORT_METHOD_ARTIST_IGNORE_THE || + sortMethod == SORT_METHOD_ALBUM_IGNORE_THE || + sortMethod == SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE || + sortMethod == SORT_METHOD_STUDIO_IGNORE_THE) + sortAttributes = (SortAttribute)((int)sortAttributes | SortAttributeIgnoreArticle); + if (sortMethod == SORT_METHOD_FILE || sortMethod == SORT_METHOD_VIDEO_SORT_TITLE || sortMethod == SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE || @@ -1635,15 +1660,44 @@ void CFileItemList::Sort(SORT_METHOD sortMethod, SORT_ORDER sortOrder) sortMethod == SORT_METHOD_DATEADDED || sortMethod == SORT_METHOD_VIDEO_RATING || sortMethod == SORT_METHOD_YEAR || + sortMethod == SORT_METHOD_PLAYLIST_ORDER || sortMethod == SORT_METHOD_LASTPLAYED || sortMethod == SORT_METHOD_PLAYCOUNT || m_sortIgnoreFolders) - Sort(sortOrder==SORT_ORDER_ASC ? SSortFileItem::IgnoreFoldersAscending : SSortFileItem::IgnoreFoldersDescending); - else if (sortMethod != SORT_METHOD_NONE && sortMethod != SORT_METHOD_UNSORTED) - Sort(sortOrder==SORT_ORDER_ASC ? SSortFileItem::Ascending : SSortFileItem::Descending); + sortAttributes = (SortAttribute)((int)sortAttributes | SortAttributeIgnoreFolders); + + if (sortBy == SortByNone) + return; + + SortItems sortItems((size_t)Size()); + for (int index = 0; index < Size(); index++) + { + m_items[index]->ToSortable(sortItems[index]); + sortItems[index][FieldId] = index; + } + + // do the sorting + SortUtils::Sort(sortBy, sortOrder, sortAttributes, sortItems); + + // apply the new order to the existing CFileItems + VECFILEITEMS sortedFileItems; + sortedFileItems.reserve(Size()); + for (SortItems::const_iterator it = sortItems.begin(); it != sortItems.end(); it++) + { + CFileItemPtr item = m_items[(int)it->at(FieldId).asInteger()]; + // Set the sort label in the CFileItem + CStdString sortLabel; + g_charsetConverter.wToUTF8(it->at(FieldSort).asWideString(), sortLabel); + item->SetSortLabel(sortLabel); + + sortedFileItems.push_back(item); + } + + // replace the current list with the re-ordered one + m_items.assign(sortedFileItems.begin(), sortedFileItems.end()); - m_sortMethod=sortMethod; - m_sortOrder=sortOrder; + m_sortMethod = sortMethod; + m_sortOrder = sortOrder; } void CFileItemList::Randomize() @@ -1728,7 +1782,7 @@ void CFileItemList::Archive(CArchive& ar) ar >> (int&)tempint; m_sortMethod = SORT_METHOD(tempint); ar >> (int&)tempint; - m_sortOrder = SORT_ORDER(tempint); + m_sortOrder = SortOrder(tempint); ar >> m_sortIgnoreFolders; ar >> (int&)tempint; m_cacheToDisc = CACHE_TYPE(tempint); @@ -1998,7 +2052,7 @@ void CFileItemList::Stack(bool stackFiles /* = true */) SetProperty("isstacked", true); // items needs to be sorted for stuff below to work properly - Sort(SORT_METHOD_LABEL, SORT_ORDER_ASC); + Sort(SORT_METHOD_LABEL, SortOrderAscending); StackFolders(); @@ -2990,8 +3044,8 @@ void CFileItemList::SetReplaceListing(bool replace) void CFileItemList::ClearSortState() { - m_sortMethod=SORT_METHOD_NONE; - m_sortOrder=SORT_ORDER_NONE; + m_sortMethod = SORT_METHOD_NONE; + m_sortOrder = SortOrderNone; } CVideoInfoTag* CFileItem::GetVideoInfoTag() diff --git a/xbmc/FileItem.h b/xbmc/FileItem.h index 77ac0fb1b50e7..7ecc60400a507 100644 --- a/xbmc/FileItem.h +++ b/xbmc/FileItem.h @@ -28,6 +28,7 @@ #include "guilib/GUIListItem.h" #include "utils/Archive.h" #include "utils/ISerializable.h" +#include "utils/ISortable.h" #include "XBDateTime.h" #include "SortFileItem.h" #include "utils/LabelFormatter.h" @@ -61,7 +62,7 @@ class CMediaSource; \sa CFileItemList */ class CFileItem : - public CGUIListItem, public IArchivable, public ISerializable + public CGUIListItem, public IArchivable, public ISerializable, public ISortable { public: CFileItem(void); @@ -86,6 +87,7 @@ class CFileItem : const CFileItem& operator=(const CFileItem& item); virtual void Archive(CArchive& ar); virtual void Serialize(CVariant& value); + virtual void ToSortable(SortItem &sortable); virtual bool IsFileItem() const { return true; }; bool Exists(bool bUseCache = true) const; @@ -158,9 +160,9 @@ class CFileItem : int GetVideoContentType() const; /* return VIDEODB_CONTENT_TYPE, but don't want to include videodb in this header */ bool IsLabelPreformated() const { return m_bLabelPreformated; } void SetLabelPreformated(bool bYesNo) { m_bLabelPreformated=bYesNo; } - bool SortsOnTop() const { return m_specialSort == SORT_ON_TOP; } - bool SortsOnBottom() const { return m_specialSort == SORT_ON_BOTTOM; } - void SetSpecialSort(SPECIAL_SORT sort) { m_specialSort = sort; } + bool SortsOnTop() const { return m_specialSort == SortSpecialOnTop; } + bool SortsOnBottom() const { return m_specialSort == SortSpecialOnBottom; } + void SetSpecialSort(SortSpecial sort) { m_specialSort = sort; } inline bool HasMusicInfoTag() const { @@ -317,7 +319,7 @@ class CFileItem : private: CStdString m_strPath; ///< complete path to item - SPECIAL_SORT m_specialSort; + SortSpecial m_specialSort; bool m_bIsParentFolder; bool m_bCanQueue; bool m_bLabelPreformated; @@ -401,7 +403,7 @@ class CFileItemList : public CFileItem void Assign(const CFileItemList& itemlist, bool append = false); bool Copy (const CFileItemList& item); void Reserve(int iCount); - void Sort(SORT_METHOD sortMethod, SORT_ORDER sortOrder); + void Sort(SORT_METHOD sortMethod, SortOrder sortOrder); void Randomize(); void SetMusicThumbs(); void FillInDefaultIcons(); @@ -422,7 +424,7 @@ class CFileItemList : public CFileItem */ void Stack(bool stackFiles = true); - SORT_ORDER GetSortOrder() const { return m_sortOrder; } + SortOrder GetSortOrder() const { return m_sortOrder; } SORT_METHOD GetSortMethod() const { return m_sortMethod; } /*! \brief load a CFileItemList out of the cache @@ -510,7 +512,7 @@ class CFileItemList : public CFileItem MAPFILEITEMS m_map; bool m_fastLookup; SORT_METHOD m_sortMethod; - SORT_ORDER m_sortOrder; + SortOrder m_sortOrder; bool m_sortIgnoreFolders; CACHE_TYPE m_cacheToDisc; bool m_replaceListing; diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp index 6059c1b0cb919..e37c9b1780bf3 100644 --- a/xbmc/GUIInfoManager.cpp +++ b/xbmc/GUIInfoManager.cpp @@ -880,11 +880,11 @@ int CGUIInfoManager::TranslateSingleString(const CStdString &strCondition) } if (prop.name == "sortdirection") { - SORT_ORDER order = SORT_ORDER_NONE; + SortOrder order = SortOrderNone; if (prop.param().Equals("ascending")) - order = SORT_ORDER_ASC; + order = SortOrderAscending; else if (prop.param().Equals("descending")) - order = SORT_ORDER_DESC; + order = SortOrderDescending; return AddMultiInfo(GUIInfo(CONTAINER_SORT_DIRECTION, order)); } else if (prop.name == "sort") diff --git a/xbmc/GUIViewState.cpp b/xbmc/GUIViewState.cpp index e47160e20947b..b1976cf5c14b3 100644 --- a/xbmc/GUIViewState.cpp +++ b/xbmc/GUIViewState.cpp @@ -141,14 +141,14 @@ CGUIViewState::CGUIViewState(const CFileItemList& items) : m_items(items) m_currentViewAsControl=0; m_currentSortMethod=0; m_playlist = PLAYLIST_NONE; - m_sortOrder=SORT_ORDER_ASC; + m_sortOrder = SortOrderAscending; } CGUIViewState::~CGUIViewState() { } -SORT_ORDER CGUIViewState::GetDisplaySortOrder() const +SortOrder CGUIViewState::GetDisplaySortOrder() const { // we actually treat some sort orders in reverse, so that we can have // the one sort order variable to save but it can be ascending usually, @@ -159,18 +159,18 @@ SORT_ORDER CGUIViewState::GetDisplaySortOrder() const sortMethod == SORT_METHOD_VIDEO_RATING || sortMethod == SORT_METHOD_PROGRAM_COUNT || sortMethod == SORT_METHOD_SONG_RATING || sortMethod == SORT_METHOD_BITRATE || sortMethod == SORT_METHOD_LISTENERS) { - if (m_sortOrder == SORT_ORDER_ASC) return SORT_ORDER_DESC; - if (m_sortOrder == SORT_ORDER_DESC) return SORT_ORDER_ASC; + if (m_sortOrder == SortOrderAscending) return SortOrderDescending; + if (m_sortOrder == SortOrderDescending) return SortOrderAscending; } return m_sortOrder; } -SORT_ORDER CGUIViewState::SetNextSortOrder() +SortOrder CGUIViewState::SetNextSortOrder() { - if (m_sortOrder==SORT_ORDER_ASC) - SetSortOrder(SORT_ORDER_DESC); + if (m_sortOrder == SortOrderAscending) + SetSortOrder(SortOrderDescending); else - SetSortOrder(SORT_ORDER_ASC); + SetSortOrder(SortOrderAscending); SaveViewState(); @@ -396,15 +396,15 @@ CGUIViewStateGeneral::CGUIViewStateGeneral(const CFileItemList& items) : CGUIVie SetViewAsControl(DEFAULT_VIEW_LIST); - SetSortOrder(SORT_ORDER_ASC); + SetSortOrder(SortOrderAscending); } -void CGUIViewState::SetSortOrder(SORT_ORDER sortOrder) +void CGUIViewState::SetSortOrder(SortOrder sortOrder) { if (GetSortMethod() == SORT_METHOD_NONE) - m_sortOrder = SORT_ORDER_NONE; - else if (sortOrder == SORT_ORDER_NONE) - m_sortOrder = SORT_ORDER_ASC; + m_sortOrder = SortOrderNone; + else if (sortOrder == SortOrderNone) + m_sortOrder = SortOrderAscending; else m_sortOrder = sortOrder; } @@ -454,7 +454,7 @@ CGUIViewStateFromItems::CGUIViewStateFromItems(const CFileItemList &items) : CGU SetViewAsControl(DEFAULT_VIEW_LIST); - SetSortOrder(SORT_ORDER_ASC); + SetSortOrder(SortOrderAscending); if (items.IsPlugin()) { CURL url(items.GetPath()); @@ -480,7 +480,7 @@ CGUIViewStateLibrary::CGUIViewStateLibrary(const CFileItemList &items) : CGUIVie { AddSortMethod(SORT_METHOD_NONE, 551, LABEL_MASKS("%F", "%I", "%L", "")); // Filename, Size | Foldername, empty SetSortMethod(SORT_METHOD_NONE); - SetSortOrder(SORT_ORDER_NONE); + SetSortOrder(SortOrderNone); SetViewAsControl(DEFAULT_VIEW_LIST); diff --git a/xbmc/GUIViewState.h b/xbmc/GUIViewState.h index d9cf115df8d84..928e059a689fe 100644 --- a/xbmc/GUIViewState.h +++ b/xbmc/GUIViewState.h @@ -46,9 +46,9 @@ class CGUIViewState void GetSortMethodLabelMasks(LABEL_MASKS& masks) const; void GetSortMethods(std::vector< std::pair > &sortMethods) const; - SORT_ORDER SetNextSortOrder(); - SORT_ORDER GetSortOrder() const { return m_sortOrder; }; - SORT_ORDER GetDisplaySortOrder() const; + SortOrder SetNextSortOrder(); + SortOrder GetSortOrder() const { return m_sortOrder; }; + SortOrder GetDisplaySortOrder() const; virtual bool HideExtensions(); virtual bool HideParentDirItems(); virtual bool DisableAddSourceButtons(); @@ -77,7 +77,7 @@ class CGUIViewState void AddSortMethod(SORT_METHOD sortMethod, int buttonLabel, LABEL_MASKS labelmasks); void SetSortMethod(SORT_METHOD sortMethod); - void SetSortOrder(SORT_ORDER sortOrder); + void SetSortOrder(SortOrder sortOrder); const CFileItemList& m_items; static VECSOURCES m_sources; @@ -88,7 +88,7 @@ class CGUIViewState std::vector m_sortMethods; int m_currentSortMethod; - SORT_ORDER m_sortOrder; + SortOrder m_sortOrder; static CStdString m_strPlaylistDirectory; }; diff --git a/xbmc/Makefile.in b/xbmc/Makefile.in index 1805218e60661..0221130dfa18b 100644 --- a/xbmc/Makefile.in +++ b/xbmc/Makefile.in @@ -19,7 +19,6 @@ SRCS=Application.cpp \ PlayListPlayer.cpp \ PartyModeManager.cpp \ SectionLoader.cpp \ - SortFileItem.cpp \ SystemGlobals.cpp \ Temperature.cpp \ TextureCache.cpp \ diff --git a/xbmc/SortFileItem.cpp b/xbmc/SortFileItem.cpp deleted file mode 100644 index 15a56d7dd9389..0000000000000 --- a/xbmc/SortFileItem.cpp +++ /dev/null @@ -1,500 +0,0 @@ -/* - * Copyright (C) 2005-2008 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "SortFileItem.h" -#include "settings/AdvancedSettings.h" -#include "utils/StringUtils.h" -#include "music/tags/MusicInfoTag.h" -#include "FileItem.h" -#include "URL.h" -#include "utils/log.h" -#include "video/VideoInfoTag.h" - -#define RETURN_IF_NULL(x,y) if ((x) == NULL) { CLog::Log(LOGWARNING, "%s, sort item is null", __FUNCTION__); return y; } - -CStdString SSortFileItem::RemoveArticles(const CStdString &label) -{ - for (unsigned int i=0;iSortsOnTop() != right->SortsOnTop()) - return left->SortsOnTop(); - if (left->SortsOnBottom() != right->SortsOnBottom()) - return !left->SortsOnBottom(); - if (left->SortsOnTop() || left->SortsOnBottom()) - return false; // both have either sort on top or sort on bottom -> leave as-is - if (left->m_bIsFolder == right->m_bIsFolder) - return StringUtils::AlphaNumericCompare(left->GetSortLabel().c_str(),right->GetSortLabel().c_str()) < 0; - return left->m_bIsFolder; -} - -bool SSortFileItem::Descending(const CFileItemPtr &left, const CFileItemPtr &right) -{ - // sanity - RETURN_IF_NULL(left,false); RETURN_IF_NULL(right,false); - - // ignore items that should sort on top or bottom - if (left->SortsOnTop() != right->SortsOnTop()) - return left->SortsOnTop(); - if (left->SortsOnBottom() != right->SortsOnBottom()) - return !left->SortsOnBottom(); - if (left->SortsOnTop() || left->SortsOnBottom()) - return false; // both have either sort on top or sort on bottom -> leave as-is - if (left->m_bIsFolder == right->m_bIsFolder) - return StringUtils::AlphaNumericCompare(left->GetSortLabel().c_str(),right->GetSortLabel().c_str()) > 0; - return left->m_bIsFolder; -} - -bool SSortFileItem::IgnoreFoldersAscending(const CFileItemPtr &left, const CFileItemPtr &right) -{ - // sanity - RETURN_IF_NULL(left,false); RETURN_IF_NULL(right,false); - - // ignore items that should sort on top or bottom - if (left->SortsOnTop() != right->SortsOnTop()) - return left->SortsOnTop(); - if (left->SortsOnBottom() != right->SortsOnBottom()) - return !left->SortsOnBottom(); - if (left->SortsOnTop() || left->SortsOnBottom()) - return false; // both have either sort on top or sort on bottom -> leave as-is - return StringUtils::AlphaNumericCompare(left->GetSortLabel().c_str(),right->GetSortLabel().c_str()) < 0; -} - -bool SSortFileItem::IgnoreFoldersDescending(const CFileItemPtr &left, const CFileItemPtr &right) -{ - // sanity - RETURN_IF_NULL(left,false); RETURN_IF_NULL(right,false); - - // ignore items that should sort on top or bottom - if (left->SortsOnTop() != right->SortsOnTop()) - return left->SortsOnTop(); - if (left->SortsOnBottom() != right->SortsOnBottom()) - return !left->SortsOnBottom(); - if (left->SortsOnTop() || left->SortsOnBottom()) - return false; // both have either sort on top or sort on bottom -> leave as-is - return StringUtils::AlphaNumericCompare(left->GetSortLabel().c_str(),right->GetSortLabel().c_str()) > 0; -} - -void SSortFileItem::ByLabel(CFileItemPtr &item) -{ - if (!item) return; - item->SetSortLabel(item->GetLabel()); -} - -void SSortFileItem::ByLabelNoThe(CFileItemPtr &item) -{ - if (!item) return; - item->SetSortLabel(RemoveArticles(item->GetLabel())); -} - -void SSortFileItem::ByFile(CFileItemPtr &item) -{ - if (!item) return; - - CURL url(item->GetPath()); - CStdString label; - label.Format("%s %d", url.GetFileNameWithoutPath().c_str(), item->m_lStartOffset); - item->SetSortLabel(label); -} - -void SSortFileItem::ByFullPath(CFileItemPtr &item) -{ - if (!item) return; - - CStdString label; - label.Format("%s %d", item->GetPath(), item->m_lStartOffset); - item->SetSortLabel(label); -} - -void SSortFileItem::ByLastPlayed(CFileItemPtr &item) -{ - if (!item) return; - - if (item->HasVideoInfoTag()) - item->SetSortLabel(item->GetVideoInfoTag()->m_lastPlayed.GetAsDBDateTime()); - else if (item->HasMusicInfoTag()) // TODO: No last played info in the fileitem for music - item->SetSortLabel(item->GetMusicInfoTag()->GetTitle()); - else - item->SetSortLabel(item->GetLabel()); -} - -void SSortFileItem::ByPlayCount(CFileItemPtr &item) -{ - if (!item) return; - - CStdString label; - if (item->HasVideoInfoTag()) - label.Format("%i %s", item->GetVideoInfoTag()->m_playCount, item->GetLabel().c_str()); - if (item->HasMusicInfoTag()) - label.Format("%i %s", item->GetMusicInfoTag()->GetPlayCount(), item->GetLabel().c_str()); - - item->SetSortLabel(label); -} - -void SSortFileItem::ByDate(CFileItemPtr &item) -{ - if (!item) return; - - CStdString label; - label.Format("%s %s", item->m_dateTime.GetAsDBDateTime().c_str(), item->GetLabel().c_str()); - item->SetSortLabel(label); -} - -void SSortFileItem::ByDateAdded(CFileItemPtr &item) -{ - if (!item) return; - - CStdString label; - label.Format("%s %d", item->GetVideoInfoTag()->m_dateAdded.GetAsDBDateTime().c_str(), item->GetVideoInfoTag()->m_iFileId); - item->SetSortLabel(label); -} - -void SSortFileItem::BySize(CFileItemPtr &item) -{ - if (!item) return; - - CStdString label; - label.Format("%"PRId64, item->m_dwSize); - item->SetSortLabel(label); -} - -void SSortFileItem::ByDriveType(CFileItemPtr &item) -{ - if (!item) return; - - CStdString label; - label.Format("%d %s", item->m_iDriveType, item->GetLabel().c_str()); - item->SetSortLabel(label); -} - -void SSortFileItem::BySongTitle(CFileItemPtr &item) -{ - if (!item) return; - item->SetSortLabel(item->GetMusicInfoTag()->GetTitle()); -} - -void SSortFileItem::BySongTitleNoThe(CFileItemPtr &item) -{ - if (!item) return; - item->SetSortLabel(RemoveArticles(item->GetMusicInfoTag()->GetTitle())); -} - -void SSortFileItem::BySongAlbum(CFileItemPtr &item) -{ - if (!item) return; - - CStdString label; - if (item->HasMusicInfoTag()) - label = item->GetMusicInfoTag()->GetAlbum(); - else if (item->HasVideoInfoTag()) - label = item->GetVideoInfoTag()->m_strAlbum; - - CStdString artist; - if (item->HasMusicInfoTag()) - artist = StringUtils::Join(item->GetMusicInfoTag()->GetArtist(), g_advancedSettings.m_musicItemSeparator); - else if (item->HasVideoInfoTag()) - artist = StringUtils::Join(item->GetVideoInfoTag()->m_artist, g_advancedSettings.m_videoItemSeparator); - label += " " + artist; - - if (item->HasMusicInfoTag()) - label.AppendFormat(" %i", item->GetMusicInfoTag()->GetTrackAndDiskNumber()); - - item->SetSortLabel(label); -} - -void SSortFileItem::BySongAlbumNoThe(CFileItemPtr &item) -{ - if (!item) return; - CStdString label; - if (item->HasMusicInfoTag()) - label = item->GetMusicInfoTag()->GetAlbum(); - else if (item->HasVideoInfoTag()) - label = item->GetVideoInfoTag()->m_strAlbum; - label = RemoveArticles(label); - - CStdString artist; - if (item->HasMusicInfoTag()) - artist = StringUtils::Join(item->GetMusicInfoTag()->GetArtist(), g_advancedSettings.m_musicItemSeparator); - else if (item->HasVideoInfoTag()) - artist = StringUtils::Join(item->GetVideoInfoTag()->m_artist, g_advancedSettings.m_videoItemSeparator); - label += " " + RemoveArticles(artist); - - if (item->HasMusicInfoTag()) - label.AppendFormat(" %i", item->GetMusicInfoTag()->GetTrackAndDiskNumber()); - - item->SetSortLabel(label); -} - -void SSortFileItem::BySongArtist(CFileItemPtr &item) -{ - if (!item) return; - - CStdString label; - if (item->HasMusicInfoTag()) - label = StringUtils::Join(item->GetMusicInfoTag()->GetArtist(), g_advancedSettings.m_musicItemSeparator); - else if (item->HasVideoInfoTag()) - label = StringUtils::Join(item->GetVideoInfoTag()->m_artist, g_advancedSettings.m_videoItemSeparator); - - if (g_advancedSettings.m_bMusicLibraryAlbumsSortByArtistThenYear) - { - int year = 0; - if (item->HasMusicInfoTag()) - year = item->GetMusicInfoTag()->GetYear(); - else if (item->HasVideoInfoTag()) - year = item->GetVideoInfoTag()->m_iYear; - label.AppendFormat(" %i", year); - } - - CStdString album; - if (item->HasMusicInfoTag()) - album = item->GetMusicInfoTag()->GetAlbum(); - else if (item->HasVideoInfoTag()) - album = item->GetVideoInfoTag()->m_strAlbum; - label += " " + album; - - if (item->HasMusicInfoTag()) - label.AppendFormat(" %i", item->GetMusicInfoTag()->GetTrackAndDiskNumber()); - - item->SetSortLabel(label); -} - -void SSortFileItem::BySongArtistNoThe(CFileItemPtr &item) -{ - if (!item) return; - - CStdString label; - if (item->HasMusicInfoTag()) - label = StringUtils::Join(item->GetMusicInfoTag()->GetArtist(), g_advancedSettings.m_musicItemSeparator); - else if (item->HasVideoInfoTag()) - label = StringUtils::Join(item->GetVideoInfoTag()->m_artist, g_advancedSettings.m_videoItemSeparator); - label = RemoveArticles(label); - - if (g_advancedSettings.m_bMusicLibraryAlbumsSortByArtistThenYear) - { - int year = 0; - if (item->HasMusicInfoTag()) - year = item->GetMusicInfoTag()->GetYear(); - else if (item->HasVideoInfoTag()) - year = item->GetVideoInfoTag()->m_iYear; - label.AppendFormat(" %i", year); - } - - CStdString album; - if (item->HasMusicInfoTag()) - album = item->GetMusicInfoTag()->GetAlbum(); - else if (item->HasVideoInfoTag()) - album = item->GetVideoInfoTag()->m_strAlbum; - label += " " + RemoveArticles(album); - - if (item->HasMusicInfoTag()) - label.AppendFormat(" %i", item->GetMusicInfoTag()->GetTrackAndDiskNumber()); - - item->SetSortLabel(label); -} - -void SSortFileItem::BySongTrackNum(CFileItemPtr &item) -{ - if (!item) return; - CStdString label; - if (item->HasMusicInfoTag()) - label.Format("%i", item->GetMusicInfoTag()->GetTrackAndDiskNumber()); - if (item->HasVideoInfoTag()) - label.Format("%i", item->GetVideoInfoTag()->m_iTrack); - item->SetSortLabel(label); -} - -void SSortFileItem::BySongDuration(CFileItemPtr &item) -{ - if (!item) return; - CStdString label; - label.Format("%i", item->GetMusicInfoTag()->GetDuration()); - item->SetSortLabel(label); -} - -void SSortFileItem::BySongRating(CFileItemPtr &item) -{ - if (!item) return; - CStdString label; - label.Format("%c %s", item->GetMusicInfoTag()->GetRating(), item->GetMusicInfoTag()->GetTitle().c_str()); - item->SetSortLabel(label); -} - -void SSortFileItem::ByProgramCount(CFileItemPtr &item) -{ - if (!item) return; - CStdString label; - label.Format("%i", item->m_iprogramCount); - item->SetSortLabel(label); -} - -void SSortFileItem::ByGenre(CFileItemPtr &item) -{ - if (!item) return; - - if (item->HasMusicInfoTag()) - item->SetSortLabel(StringUtils::Join(item->GetMusicInfoTag()->GetGenre(), g_advancedSettings.m_musicItemSeparator)); - else - item->SetSortLabel(StringUtils::Join(item->GetVideoInfoTag()->m_genre, g_advancedSettings.m_videoItemSeparator)); -} - -void SSortFileItem::ByCountry(CFileItemPtr &item) -{ - if (!item) return; - item->SetSortLabel(StringUtils::Join(item->GetVideoInfoTag()->m_country, g_advancedSettings.m_videoItemSeparator)); -} - - -void SSortFileItem::ByYear(CFileItemPtr &item) -{ - if (!item) return; - - CStdString label; - if (item->HasMusicInfoTag()) - label.Format("%i %s", item->GetMusicInfoTag()->GetYear(), item->GetLabel().c_str()); - else - label.Format("%s %s %i %s", item->GetVideoInfoTag()->m_premiered.GetAsDBDate().c_str(), item->GetVideoInfoTag()->m_firstAired.GetAsDBDate(), item->GetVideoInfoTag()->m_iYear, item->GetLabel().c_str()); - item->SetSortLabel(label); -} - -void SSortFileItem::ByMovieTitle(CFileItemPtr &item) -{ - if (!item) return; - item->SetSortLabel(item->GetVideoInfoTag()->m_strTitle); -} - -void SSortFileItem::ByMovieSortTitle(CFileItemPtr &item) -{ - if (!item) return; - if (!item->GetVideoInfoTag()->m_strSortTitle.IsEmpty()) - item->SetSortLabel(item->GetVideoInfoTag()->m_strSortTitle); - else - item->SetSortLabel(item->GetVideoInfoTag()->m_strTitle); -} - -void SSortFileItem::ByMovieSortTitleNoThe(CFileItemPtr &item) -{ - if (!item) return; - CStdString label; - if (!item->GetVideoInfoTag()->m_strSortTitle.IsEmpty()) - label = item->GetVideoInfoTag()->m_strSortTitle; - else - label = item->GetVideoInfoTag()->m_strTitle; - item->SetSortLabel(RemoveArticles(label)); -} - -void SSortFileItem::ByMovieRating(CFileItemPtr &item) -{ - if (!item) return; - CStdString label; - label.Format("%f %s", item->GetVideoInfoTag()->m_fRating, item->GetLabel().c_str()); - item->SetSortLabel(label); -} - -void SSortFileItem::ByMovieRuntime(CFileItemPtr &item) -{ - if (!item) return; - CStdString label; - if (item->GetVideoInfoTag()->m_streamDetails.GetVideoDuration() > 0) - label.Format("%i %s", item->GetVideoInfoTag()->m_streamDetails.GetVideoDuration(), item->GetLabel().c_str()); - else - label.Format("%s %s", item->GetVideoInfoTag()->m_strRuntime, item->GetLabel().c_str()); - item->SetSortLabel(label); -} - -void SSortFileItem::ByMPAARating(CFileItemPtr &item) -{ - if (!item) return; - item->SetSortLabel(item->GetVideoInfoTag()->m_strMPAARating + " " + item->GetLabel()); -} - -void SSortFileItem::ByStudio(CFileItemPtr &item) -{ - if (!item) return; - item->SetSortLabel(StringUtils::Join(item->GetVideoInfoTag()->m_studio, g_advancedSettings.m_videoItemSeparator)); -} - -void SSortFileItem::ByStudioNoThe(CFileItemPtr &item) -{ - if (!item) return; - CStdString studio = StringUtils::Join(item->GetVideoInfoTag()->m_studio, g_advancedSettings.m_videoItemSeparator); - item->SetSortLabel(RemoveArticles(studio)); -} - -void SSortFileItem::ByEpisodeNum(CFileItemPtr &item) -{ - if (!item) return; - - const CVideoInfoTag *tag = item->GetVideoInfoTag(); - - // we calculate an offset number based on the episode's - // sort season and episode values. in addition - // we include specials 'episode' numbers to get proper - // sorting of multiple specials in a row. each - // of these are given their particular ranges to semi-ensure uniqueness. - // theoretical problem: if a show has > 2^15 specials and two of these are placed - // after each other they will sort backwards. if a show has > 2^32-1 seasons - // or if a season has > 2^16-1 episodes strange things will happen (overflow) - uint64_t num; - if (tag->m_iSpecialSortEpisode > 0) - num = ((uint64_t)tag->m_iSpecialSortSeason<<32)+(tag->m_iSpecialSortEpisode<<16)-((2<<15) - tag->m_iEpisode); - else - num = ((uint64_t)tag->m_iSeason<<32)+(tag->m_iEpisode<<16); - - // check filename as there can be duplicates now - CURL file(tag->m_strFileNameAndPath); - CStdString label; - label.Format("%"PRIu64" %s", num, file.GetFileName().c_str()); - item->SetSortLabel(label); -} - -void SSortFileItem::ByProductionCode(CFileItemPtr &item) -{ - if (!item) return; - item->SetSortLabel(item->GetVideoInfoTag()->m_strProductionCode); -} - -void SSortFileItem::ByBitrate(CFileItemPtr &item) -{ - if (!item) return; - CStdString label; - label.Format("%"PRId64, item->m_dwSize); - item->SetSortLabel(label); -} - -void SSortFileItem::ByListeners(CFileItemPtr &item) -{ - if (!item) return; - CStdString label; - label.Format("%i", item->GetMusicInfoTag()->GetListeners()); - item->SetSortLabel(label); -} diff --git a/xbmc/SortFileItem.h b/xbmc/SortFileItem.h index 9c64c576ad2fc..4f017a5171148 100644 --- a/xbmc/SortFileItem.h +++ b/xbmc/SortFileItem.h @@ -21,65 +21,7 @@ */ #include "utils/LabelFormatter.h" -#include - -class CFileItem; typedef boost::shared_ptr CFileItemPtr; - -struct SSortFileItem -{ - /*! \brief Remove any articles (eg "the", "a") from the start of a label - \param label the label to process - \return the label stripped of any articles - */ - static CStdString RemoveArticles(const CStdString &label); - - // Sort by sort field - static bool Ascending(const CFileItemPtr &left, const CFileItemPtr &right); - static bool Descending(const CFileItemPtr &left, const CFileItemPtr &right); - static bool IgnoreFoldersAscending(const CFileItemPtr &left, const CFileItemPtr &right); - static bool IgnoreFoldersDescending(const CFileItemPtr &left, const CFileItemPtr &right); - - // Fill in sort field - static void ByLabel(CFileItemPtr &item); - static void ByLabelNoThe(CFileItemPtr &item); - static void ByFile(CFileItemPtr &item); - static void ByFullPath(CFileItemPtr &item); - static void ByDate(CFileItemPtr &item); - static void ByDateAdded(CFileItemPtr &item); - static void BySize(CFileItemPtr &item); - static void ByDriveType(CFileItemPtr &item); - static void BySongTitle(CFileItemPtr &item); - static void BySongTitleNoThe(CFileItemPtr &item); - static void BySongAlbum(CFileItemPtr &item); - static void BySongAlbumNoThe(CFileItemPtr &item); - static void BySongArtist(CFileItemPtr &item); - static void BySongArtistNoThe(CFileItemPtr &item); - static void BySongTrackNum(CFileItemPtr &item); - static void BySongDuration(CFileItemPtr &item); - static void BySongRating(CFileItemPtr &item); - - static void ByProgramCount(CFileItemPtr &item); - - static void ByGenre(CFileItemPtr &item); - static void ByCountry(CFileItemPtr &item); - static void ByYear(CFileItemPtr &item); - - static void ByMovieTitle(CFileItemPtr &item); - static void ByMovieSortTitle(CFileItemPtr &item); - static void ByMovieSortTitleNoThe(CFileItemPtr &item); - static void ByMovieRating(CFileItemPtr &item); - static void ByMovieRuntime(CFileItemPtr &item); - static void ByMPAARating(CFileItemPtr &item); - static void ByStudio(CFileItemPtr &item); - static void ByStudioNoThe(CFileItemPtr &item); - - static void ByEpisodeNum(CFileItemPtr &item); - static void ByProductionCode(CFileItemPtr &item); - static void ByLastPlayed(CFileItemPtr &item); - static void ByPlayCount(CFileItemPtr &item); - static void ByBitrate(CFileItemPtr &item); - static void ByListeners(CFileItemPtr &item); -}; +#include "utils/SortUtils.h" typedef enum { SORT_METHOD_NONE=0, @@ -124,18 +66,6 @@ typedef enum { SORT_METHOD_MAX } SORT_METHOD; -typedef enum { - SORT_ORDER_NONE=0, - SORT_ORDER_ASC, - SORT_ORDER_DESC -} SORT_ORDER; - -typedef enum { - SORT_NORMALLY=0, - SORT_ON_TOP, - SORT_ON_BOTTOM -} SPECIAL_SORT; - typedef struct { SORT_METHOD m_sortMethod; diff --git a/xbmc/ViewDatabase.cpp b/xbmc/ViewDatabase.cpp index 90292c007db78..c21d1535bb8ff 100644 --- a/xbmc/ViewDatabase.cpp +++ b/xbmc/ViewDatabase.cpp @@ -99,7 +99,7 @@ bool CViewDatabase::GetViewState(const CStdString &path, int window, CViewState { // have some information state.m_viewMode = m_pDS->fv("viewMode").get_asInt(); state.m_sortMethod = (SORT_METHOD)m_pDS->fv("sortMethod").get_asInt(); - state.m_sortOrder = (SORT_ORDER)m_pDS->fv("sortOrder").get_asInt(); + state.m_sortOrder = (SortOrder)m_pDS->fv("sortOrder").get_asInt(); m_pDS->close(); return true; } diff --git a/xbmc/ViewState.h b/xbmc/ViewState.h index 3dc24c2b8d585..836d64c247287 100644 --- a/xbmc/ViewState.h +++ b/xbmc/ViewState.h @@ -33,7 +33,7 @@ class CViewState { public: - CViewState(int viewMode, SORT_METHOD sortMethod, SORT_ORDER sortOrder) + CViewState(int viewMode, SORT_METHOD sortMethod, SortOrder sortOrder) { m_viewMode = viewMode; m_sortMethod = sortMethod; @@ -43,10 +43,10 @@ class CViewState { m_viewMode = 0; m_sortMethod = SORT_METHOD_LABEL; - m_sortOrder = SORT_ORDER_ASC; + m_sortOrder = SortOrderAscending; }; int m_viewMode; SORT_METHOD m_sortMethod; - SORT_ORDER m_sortOrder; + SortOrder m_sortOrder; }; diff --git a/xbmc/addons/GUIDialogAddonInfo.cpp b/xbmc/addons/GUIDialogAddonInfo.cpp index e631c26c78ba2..c3bf5a3c067aa 100644 --- a/xbmc/addons/GUIDialogAddonInfo.cpp +++ b/xbmc/addons/GUIDialogAddonInfo.cpp @@ -378,7 +378,7 @@ void CGUIDialogAddonInfo::GrabRollbackVersions() { CFileItemList items; XFILE::CDirectory::GetDirectory("special://home/addons/packages/",items,".zip",DIR_FLAG_NO_FILE_DIRS); - items.Sort(SORT_METHOD_LABEL,SORT_ORDER_ASC); + items.Sort(SORT_METHOD_LABEL, SortOrderAscending); for (int i=0;im_bIsFolder) diff --git a/xbmc/addons/GUIViewStateAddonBrowser.cpp b/xbmc/addons/GUIViewStateAddonBrowser.cpp index 2d37eb3d0565d..91e35f2742325 100644 --- a/xbmc/addons/GUIViewStateAddonBrowser.cpp +++ b/xbmc/addons/GUIViewStateAddonBrowser.cpp @@ -39,7 +39,7 @@ CGUIViewStateAddonBrowser::CGUIViewStateAddonBrowser(const CFileItemList& items) SetViewAsControl(DEFAULT_VIEW_AUTO); - SetSortOrder(SORT_ORDER_ASC); + SetSortOrder(SortOrderAscending); LoadViewState(items.GetPath(), WINDOW_ADDON_BROWSER); } diff --git a/xbmc/addons/GUIWindowAddonBrowser.cpp b/xbmc/addons/GUIWindowAddonBrowser.cpp index d15430396d02d..de34c94ab74cb 100644 --- a/xbmc/addons/GUIWindowAddonBrowser.cpp +++ b/xbmc/addons/GUIWindowAddonBrowser.cpp @@ -449,10 +449,10 @@ int CGUIWindowAddonBrowser::SelectAddonID(const vector &types, CStd item->SetLabel(g_localizeStrings.Get(231)); item->SetLabel2(g_localizeStrings.Get(24040)); item->SetIconImage("DefaultAddonNone.png"); - item->SetSpecialSort(SORT_ON_TOP); + item->SetSpecialSort(SortSpecialOnTop); items.Add(item); } - items.Sort(SORT_METHOD_LABEL, SORT_ORDER_ASC); + items.Sort(SORT_METHOD_LABEL, SortOrderAscending); if (addonIDs.size() > 0) { diff --git a/xbmc/dialogs/GUIDialogFileBrowser.cpp b/xbmc/dialogs/GUIDialogFileBrowser.cpp index d06ce58ebfcb2..68db4dad77650 100644 --- a/xbmc/dialogs/GUIDialogFileBrowser.cpp +++ b/xbmc/dialogs/GUIDialogFileBrowser.cpp @@ -332,7 +332,7 @@ void CGUIDialogFileBrowser::ClearFileItems() void CGUIDialogFileBrowser::OnSort() { if (!m_singleList) - m_vecItems->Sort(SORT_METHOD_LABEL, SORT_ORDER_ASC); + m_vecItems->Sort(SORT_METHOD_LABEL, SortOrderAscending); } void CGUIDialogFileBrowser::Update(const CStdString &strDirectory) diff --git a/xbmc/dialogs/GUIDialogSelect.cpp b/xbmc/dialogs/GUIDialogSelect.cpp index 93c236c4d35a9..c2461dffb2a3d 100644 --- a/xbmc/dialogs/GUIDialogSelect.cpp +++ b/xbmc/dialogs/GUIDialogSelect.cpp @@ -213,7 +213,7 @@ bool CGUIDialogSelect::IsButtonPressed() void CGUIDialogSelect::Sort(bool bSortOrder /*=true*/) { - m_vecList->Sort(SORT_METHOD_LABEL,bSortOrder?SORT_ORDER_ASC:SORT_ORDER_DESC); + m_vecList->Sort(SORT_METHOD_LABEL, bSortOrder ? SortOrderAscending : SortOrderDescending); } void CGUIDialogSelect::SetSelected(int iSelected) diff --git a/xbmc/dialogs/GUIDialogSmartPlaylistEditor.cpp b/xbmc/dialogs/GUIDialogSmartPlaylistEditor.cpp index 5999638e9d1a8..27bb2b7c0e9b2 100644 --- a/xbmc/dialogs/GUIDialogSmartPlaylistEditor.cpp +++ b/xbmc/dialogs/GUIDialogSmartPlaylistEditor.cpp @@ -236,7 +236,7 @@ void CGUIDialogSmartPlaylistEditor::OnOrder() { CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), CONTROL_ORDER_FIELD); OnMessage(msg); - m_playlist.m_orderField = (CSmartPlaylistRule::DATABASE_FIELD)msg.GetParam1(); + m_playlist.m_orderField = (SortBy)msg.GetParam1(); UpdateButtons(); } @@ -271,7 +271,7 @@ void CGUIDialogSmartPlaylistEditor::UpdateButtons() for (unsigned int i = 0; i < m_playlist.m_playlistRules.size(); i++) { CFileItemPtr item(new CFileItem("", false)); - if (m_playlist.m_playlistRules[i].m_field == CSmartPlaylistRule::FIELD_NONE) + if (m_playlist.m_playlistRules[i].m_field == FieldNone) item->SetLabel(g_localizeStrings.Get(21423)); else item->SetLabel(m_playlist.m_playlistRules[i].GetLocalizedRule()); @@ -295,11 +295,11 @@ void CGUIDialogSmartPlaylistEditor::UpdateButtons() CGUIMessage msg(GUI_MSG_LABEL_RESET, GetID(), CONTROL_ORDER_FIELD); OnMessage(msg); } - vector fields = CSmartPlaylistRule::GetFields(m_playlist.GetType(), true); - for (unsigned int i = 0; i < fields.size(); i++) + vector orders = CSmartPlaylistRule::GetOrders(m_playlist.GetType()); + for (unsigned int i = 0; i < orders.size(); i++) { - CGUIMessage msg(GUI_MSG_LABEL_ADD, GetID(), CONTROL_ORDER_FIELD, fields[i]); - msg.SetLabel(CSmartPlaylistRule::GetLocalizedField(fields[i])); + CGUIMessage msg(GUI_MSG_LABEL_ADD, GetID(), CONTROL_ORDER_FIELD, orders[i]); + msg.SetLabel(CSmartPlaylistRule::GetLocalizedOrder(orders[i])); OnMessage(msg); } { @@ -451,7 +451,7 @@ void CGUIDialogSmartPlaylistEditor::OnRuleAdd() CSmartPlaylistRule rule; if (CGUIDialogSmartPlaylistRule::EditRule(rule,m_playlist.GetType())) { - if (m_playlist.m_playlistRules.size() == 1 && m_playlist.m_playlistRules[0].m_field == CSmartPlaylistRule::FIELD_NONE) + if (m_playlist.m_playlistRules.size() == 1 && m_playlist.m_playlistRules[0].m_field == FieldNone) m_playlist.m_playlistRules[0] = rule; else m_playlist.m_playlistRules.push_back(rule); diff --git a/xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp b/xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp index ff85ad2842076..a425b914f112d 100644 --- a/xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp +++ b/xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp @@ -106,7 +106,7 @@ void CGUIDialogSmartPlaylistRule::OnBrowse() type = VIDEODB_CONTENT_EPISODES; int iLabel = 0; - if (m_rule.m_field == CSmartPlaylistRule::FIELD_GENRE) + if (m_rule.m_field == FieldGenre) { if (m_type.Equals("tvshows") || m_type.Equals("episodes") || m_type.Equals("movies")) videodatabase.GetGenresNav("videodb://2/1/",items,type); @@ -120,15 +120,15 @@ void CGUIDialogSmartPlaylistRule::OnBrowse() } iLabel = 515; } - else if (m_rule.m_field == CSmartPlaylistRule::FIELD_COUNTRY) + else if (m_rule.m_field == FieldCountry) { videodatabase.GetCountriesNav("videodb://2/1/",items,type); iLabel = 574; } - else if (m_rule.m_field == CSmartPlaylistRule::FIELD_ARTIST || m_rule.m_field == CSmartPlaylistRule::FIELD_ALBUMARTIST) + else if (m_rule.m_field == FieldArtist || m_rule.m_field == FieldAlbumArtist) { if (m_type.Equals("songs") || m_type.Equals("mixed") || m_type.Equals("albums")) - database.GetArtistsNav("musicdb://5/",items,-1,m_rule.m_field == CSmartPlaylistRule::FIELD_ALBUMARTIST); + database.GetArtistsNav("musicdb://5/",items,-1,m_rule.m_field == FieldAlbumArtist); if (m_type.Equals("musicvideos") || m_type.Equals("mixed")) { CFileItemList items2; @@ -137,7 +137,7 @@ void CGUIDialogSmartPlaylistRule::OnBrowse() } iLabel = 557; } - else if (m_rule.m_field == CSmartPlaylistRule::FIELD_ALBUM) + else if (m_rule.m_field == FieldAlbum) { if (m_type.Equals("songs") || m_type.Equals("mixed") || m_type.Equals("albums")) database.GetAlbumsNav("musicdb://6/",items,-1,-1,-1,-1); @@ -149,32 +149,32 @@ void CGUIDialogSmartPlaylistRule::OnBrowse() } iLabel = 558; } - else if (m_rule.m_field == CSmartPlaylistRule::FIELD_ACTOR) + else if (m_rule.m_field == FieldActor) { videodatabase.GetActorsNav("",items,type); iLabel = 20337; } - else if (m_rule.m_field == CSmartPlaylistRule::FIELD_DIRECTOR) + else if (m_rule.m_field == FieldDirector) { videodatabase.GetDirectorsNav("",items,type); iLabel = 20339; } - else if (m_rule.m_field == CSmartPlaylistRule::FIELD_STUDIO) + else if (m_rule.m_field == FieldStudio) { videodatabase.GetStudiosNav("",items,type); iLabel = 572; } - else if (m_rule.m_field == CSmartPlaylistRule::FIELD_WRITER) + else if (m_rule.m_field == FieldWriter) { videodatabase.GetWritersNav("",items,type); iLabel = 20417; } - else if (m_rule.m_field == CSmartPlaylistRule::FIELD_TVSHOWTITLE) + else if (m_rule.m_field == FieldTvShowTitle) { videodatabase.GetTvShowsNav("",items); iLabel = 20343; } - else if (m_rule.m_field == CSmartPlaylistRule::FIELD_PLAYLIST) + else if (m_rule.m_field == FieldPlaylist) { // use filebrowser to grab another smart playlist @@ -194,7 +194,7 @@ void CGUIDialogSmartPlaylistRule::OnBrowse() } iLabel = 559; } - else if (m_rule.m_field == CSmartPlaylistRule::FIELD_PATH) + else if (m_rule.m_field == FieldPath) { VECSOURCES sources; if (m_type == "songs" || m_type == "mixed") @@ -210,7 +210,7 @@ void CGUIDialogSmartPlaylistRule::OnBrowse() UpdateButtons(); return; } - else if (m_rule.m_field == CSmartPlaylistRule::FIELD_SET) + else if (m_rule.m_field == FieldSet) { videodatabase.GetSetsNav("videodb://1/7/", items, VIDEODB_CONTENT_MOVIES); iLabel = 20434; @@ -221,7 +221,7 @@ void CGUIDialogSmartPlaylistRule::OnBrowse() } // sort the items - items.Sort(SORT_METHOD_LABEL, SORT_ORDER_ASC); + items.Sort(SORT_METHOD_LABEL, SortOrderAscending); CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT); pDialog->Reset(); @@ -248,7 +248,7 @@ void CGUIDialogSmartPlaylistRule::OnField() { CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), CONTROL_FIELD); OnMessage(msg); - m_rule.m_field = (CSmartPlaylistRule::DATABASE_FIELD)msg.GetParam1(); + m_rule.m_field = (Field)msg.GetParam1(); UpdateButtons(); } @@ -268,7 +268,7 @@ void CGUIDialogSmartPlaylistRule::UpdateButtons() SendMessage(GUI_MSG_ITEM_SELECT, CONTROL_FIELD, m_rule.m_field); CGUIMessage msg2(GUI_MSG_ITEM_SELECTED, GetID(), CONTROL_FIELD); OnMessage(msg2); - m_rule.m_field = (CSmartPlaylistRule::DATABASE_FIELD)msg2.GetParam1(); + m_rule.m_field = (Field)msg2.GetParam1(); // and now update the operator set SendMessage(GUI_MSG_LABEL_RESET, CONTROL_OPERATOR); @@ -373,7 +373,7 @@ void CGUIDialogSmartPlaylistRule::OnInitWindow() ChangeButtonToEdit(CONTROL_VALUE, true); // true for single label CGUIDialog::OnInitWindow(); // add the fields to the field spincontrol - vector fields = CSmartPlaylistRule::GetFields(m_type); + vector fields = CSmartPlaylistRule::GetFields(m_type); for (unsigned int i = 0; i < fields.size(); i++) { CGUIMessage msg(GUI_MSG_LABEL_ADD, GetID(), CONTROL_FIELD, fields[i]); diff --git a/xbmc/filesystem/AddonsDirectory.cpp b/xbmc/filesystem/AddonsDirectory.cpp index 5d061bd8b0f4f..418f10f37bff4 100644 --- a/xbmc/filesystem/AddonsDirectory.cpp +++ b/xbmc/filesystem/AddonsDirectory.cpp @@ -314,7 +314,7 @@ CFileItemPtr CAddonsDirectory::GetMoreItem(const CStdString &content) item->SetLabelPreformated(true); item->SetLabel(g_localizeStrings.Get(21452)); item->SetIconImage("DefaultAddon.png"); - item->SetSpecialSort(SORT_ON_BOTTOM); + item->SetSpecialSort(SortSpecialOnBottom); return item; } diff --git a/xbmc/filesystem/LibraryDirectory.cpp b/xbmc/filesystem/LibraryDirectory.cpp index 937a305024c2e..6227791c9b898 100644 --- a/xbmc/filesystem/LibraryDirectory.cpp +++ b/xbmc/filesystem/LibraryDirectory.cpp @@ -141,7 +141,7 @@ bool CLibraryDirectory::GetDirectory(const CStdString& strPath, CFileItemList &i items.Add(item); } } - items.Sort(SORT_METHOD_PLAYLIST_ORDER, SORT_ORDER_ASC); + items.Sort(SORT_METHOD_PLAYLIST_ORDER, SortOrderAscending); return true; } diff --git a/xbmc/filesystem/MultiPathDirectory.cpp b/xbmc/filesystem/MultiPathDirectory.cpp index 9fc431baeaebc..a17907f0b7987 100644 --- a/xbmc/filesystem/MultiPathDirectory.cpp +++ b/xbmc/filesystem/MultiPathDirectory.cpp @@ -252,7 +252,7 @@ void CMultiPathDirectory::MergeItems(CFileItemList &items) return; // sort items by label // folders are before files in this sort method - items.Sort(SORT_METHOD_LABEL, SORT_ORDER_ASC); + items.Sort(SORT_METHOD_LABEL, SortOrderAscending); int i = 0; // if first item in the sorted list is a file, just abort diff --git a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNode.cpp b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNode.cpp index dd5bf09e7f8c8..6d87ce49888b4 100644 --- a/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNode.cpp +++ b/xbmc/filesystem/MusicDatabaseDirectory/DirectoryNode.cpp @@ -333,7 +333,7 @@ void CDirectoryNode::AddQueuingFolder(CFileItemList& items) const if (pItem) { pItem->m_bIsFolder = true; - pItem->SetSpecialSort(g_advancedSettings.m_bMusicLibraryAllItemsOnBottom ? SORT_ON_BOTTOM : SORT_ON_TOP); + pItem->SetSpecialSort(g_advancedSettings.m_bMusicLibraryAllItemsOnBottom ? SortSpecialOnBottom : SortSpecialOnTop); pItem->SetCanQueue(false); pItem->SetLabelPreformated(true); if (g_advancedSettings.m_bMusicLibraryAllItemsOnBottom) diff --git a/xbmc/filesystem/RarManager.cpp b/xbmc/filesystem/RarManager.cpp index 2321e0d377686..a96183a9cd320 100644 --- a/xbmc/filesystem/RarManager.cpp +++ b/xbmc/filesystem/RarManager.cpp @@ -120,7 +120,7 @@ bool CRarManager::CacheRarredFile(CStdString& strPathInCache, const CStdString& { CFileItemList items; CDirectory::GetDirectory(g_advancedSettings.m_cachePath,items); - items.Sort(SORT_METHOD_SIZE, SORT_ORDER_DESC); + items.Sort(SORT_METHOD_SIZE, SortOrderDescending); while (items.Size() && CheckFreeSpace(strDir) < iSize) { if (!items[0]->m_bIsFolder) diff --git a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNode.cpp b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNode.cpp index 65bf74b357fa7..6fcfeaa33ec97 100644 --- a/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNode.cpp +++ b/xbmc/filesystem/VideoDatabaseDirectory/DirectoryNode.cpp @@ -337,7 +337,7 @@ void CDirectoryNode::AddQueuingFolder(CFileItemList& items) const if (pItem) { pItem->m_bIsFolder = true; - pItem->SetSpecialSort(g_advancedSettings.m_bVideoLibraryAllItemsOnBottom ? SORT_ON_BOTTOM : SORT_ON_TOP); + pItem->SetSpecialSort(g_advancedSettings.m_bVideoLibraryAllItemsOnBottom ? SortSpecialOnBottom : SortSpecialOnTop); pItem->SetCanQueue(false); items.Add(pItem); } diff --git a/xbmc/guilib/GUIBaseContainer.cpp b/xbmc/guilib/GUIBaseContainer.cpp index 9ec21fcb46b52..152a43361bd32 100644 --- a/xbmc/guilib/GUIBaseContainer.cpp +++ b/xbmc/guilib/GUIBaseContainer.cpp @@ -26,6 +26,7 @@ #include "GUIInfoManager.h" #include "utils/TimeUtils.h" #include "utils/log.h" +#include "utils/SortUtils.h" #include "utils/StringUtils.h" #include "GUIStaticItem.h" #include "Key.h" @@ -521,7 +522,7 @@ void CGUIBaseContainer::OnJumpLetter(char letter) for (unsigned int i = (offset + 1) % m_items.size(); i != offset; i = (i+1) % m_items.size()) { CGUIListItemPtr item = m_items[i]; - if (0 == strnicmp(SSortFileItem::RemoveArticles(item->GetLabel()).c_str(), m_match.c_str(), m_match.size())) + if (0 == strnicmp(SortUtils::RemoveArticles(item->GetLabel()).c_str(), m_match.c_str(), m_match.size())) { SelectItem(i); return; diff --git a/xbmc/input/ButtonTranslator.cpp b/xbmc/input/ButtonTranslator.cpp index 5da18dde5efc9..1aa4e16007788 100644 --- a/xbmc/input/ButtonTranslator.cpp +++ b/xbmc/input/ButtonTranslator.cpp @@ -444,7 +444,7 @@ bool CButtonTranslator::Load(bool AlwaysLoad) CFileItemList files; XFILE::CDirectory::GetDirectory(DIRS_TO_CHECK[dirIndex], files, ".xml"); // Sort the list for filesystem based priorities, e.g. 01-keymap.xml, 02-keymap-overrides.xml - files.Sort(SORT_METHOD_FILE, SORT_ORDER_ASC); + files.Sort(SORT_METHOD_FILE, SortOrderAscending); for(int fileIndex = 0; fileIndexm_bIsFolder) @@ -463,7 +463,7 @@ bool CButtonTranslator::Load(bool AlwaysLoad) CFileItemList files; XFILE::CDirectory::GetDirectory(devicedir, files, ".xml"); // Sort the list for filesystem based priorities, e.g. 01-keymap.xml, 02-keymap-overrides.xml - files.Sort(SORT_METHOD_FILE, SORT_ORDER_ASC); + files.Sort(SORT_METHOD_FILE, SortOrderAscending); for(int fileIndex = 0; fileIndexm_bIsFolder) diff --git a/xbmc/interfaces/http-api/XBMChttp.cpp b/xbmc/interfaces/http-api/XBMChttp.cpp index a7883dd026146..d6fa8d07d61dc 100644 --- a/xbmc/interfaces/http-api/XBMChttp.cpp +++ b/xbmc/interfaces/http-api/XBMChttp.cpp @@ -408,7 +408,7 @@ int CXbmcHttp::displayDir(int numParas, CStdString paras[]) tmp.Format("%i", dirItems.Size()); return SetResponse(openTag+tmp); } - dirItems.Sort(SORT_METHOD_LABEL, SORT_ORDER_ASC); + dirItems.Sort(SORT_METHOD_LABEL, SortOrderAscending); if (lineStart > dirItems.Size() || lineStart < 0) return SetResponse(openTag+"Error:Line start value out of range"); if (numLines == -1) @@ -495,7 +495,7 @@ void CXbmcHttp::AddItemToPlayList(const CFileItemPtr &pItem, int playList, int s CStdString strDirectory=pItem->GetPath(); CFileItemList items; CDirectory::GetDirectory(pItem->GetPath(), items, mask); - items.Sort(SORT_METHOD_LABEL, SORT_ORDER_ASC); + items.Sort(SORT_METHOD_LABEL, SortOrderAscending); for (int i=0; i < items.Size(); ++i) if (!(CFileItem*)items[i]->m_bIsFolder || recursive) AddItemToPlayList(items[i], playList, sortMethod, mask, recursive); @@ -762,7 +762,7 @@ int CXbmcHttp::xbmcGetMediaLocation(int numParas, CStdString paras[]) tmp.Format("%i",items.Size()); return SetResponse(openTag+tmp); } - items.Sort(SORT_METHOD_LABEL, SORT_ORDER_ASC); + items.Sort(SORT_METHOD_LABEL, SortOrderAscending); CStdString strLine; if (lineStart>items.Size() || lineStart<0) return SetResponse(openTag+"Error:Line start value out of range"); diff --git a/xbmc/interfaces/json-rpc/AudioLibrary.cpp b/xbmc/interfaces/json-rpc/AudioLibrary.cpp index d874cba76cf1e..0bed6c6a5dae3 100644 --- a/xbmc/interfaces/json-rpc/AudioLibrary.cpp +++ b/xbmc/interfaces/json-rpc/AudioLibrary.cpp @@ -536,14 +536,14 @@ bool CAudioLibrary::FillFileItemList(const CVariant ¶meterObject, CFileItemL // If we retrieved the list of songs by "artistid" // we sort by album (and implicitly by track number) if (artistID != -1) - list.Sort(SORT_METHOD_ALBUM_IGNORE_THE, SORT_ORDER_ASC); + list.Sort(SORT_METHOD_ALBUM_IGNORE_THE, SortOrderAscending); // If we retrieve the list of songs by "genreid" // we sort by artist (and implicitly by album and track number) else if (genreID != -1) - list.Sort(SORT_METHOD_ARTIST_IGNORE_THE, SORT_ORDER_ASC); + list.Sort(SORT_METHOD_ARTIST_IGNORE_THE, SortOrderAscending); // otherwise we sort by track number else - list.Sort(SORT_METHOD_TRACKNUM, SORT_ORDER_ASC); + list.Sort(SORT_METHOD_TRACKNUM, SortOrderAscending); } } diff --git a/xbmc/interfaces/json-rpc/FileItemHandler.cpp b/xbmc/interfaces/json-rpc/FileItemHandler.cpp index 9cc0c277c3c6e..4ff0166add8ba 100644 --- a/xbmc/interfaces/json-rpc/FileItemHandler.cpp +++ b/xbmc/interfaces/json-rpc/FileItemHandler.cpp @@ -331,12 +331,12 @@ bool CFileItemHandler::FillFileItemList(const CVariant ¶meterObject, CFileIt return (list.Size() > 0); } -bool CFileItemHandler::ParseSortMethods(const CStdString &method, const bool &ignorethe, const CStdString &order, SORT_METHOD &sortmethod, SORT_ORDER &sortorder) +bool CFileItemHandler::ParseSortMethods(const CStdString &method, const bool &ignorethe, const CStdString &order, SORT_METHOD &sortmethod, SortOrder &sortorder) { if (order.Equals("ascending")) - sortorder = SORT_ORDER_ASC; + sortorder = SortOrderAscending; else if (order.Equals("descending")) - sortorder = SORT_ORDER_DESC; + sortorder = SortOrderDescending; else return false; @@ -419,7 +419,7 @@ void CFileItemHandler::Sort(CFileItemList &items, const CVariant ¶meterObjec order = order.ToLower(); SORT_METHOD sortmethod = SORT_METHOD_NONE; - SORT_ORDER sortorder = SORT_ORDER_ASC; + SortOrder sortorder = SortOrderAscending; if (ParseSortMethods(method, parameterObject["ignorearticle"].asBoolean(), order, sortmethod, sortorder)) items.Sort(sortmethod, sortorder); diff --git a/xbmc/interfaces/json-rpc/FileItemHandler.h b/xbmc/interfaces/json-rpc/FileItemHandler.h index 53b2ab9b45a2c..3ddab51a09c6e 100644 --- a/xbmc/interfaces/json-rpc/FileItemHandler.h +++ b/xbmc/interfaces/json-rpc/FileItemHandler.h @@ -36,7 +36,7 @@ namespace JSONRPC static bool FillFileItemList(const CVariant ¶meterObject, CFileItemList &list); private: - static bool ParseSortMethods(const CStdString &method, const bool &ignorethe, const CStdString &order, SORT_METHOD &sortmethod, SORT_ORDER &sortorder); + static bool ParseSortMethods(const CStdString &method, const bool &ignorethe, const CStdString &order, SORT_METHOD &sortmethod, SortOrder &sortorder); static void Sort(CFileItemList &items, const CVariant& parameterObject); }; } diff --git a/xbmc/interfaces/json-rpc/FileOperations.cpp b/xbmc/interfaces/json-rpc/FileOperations.cpp index e1116facc2aee..6cfb46843f12e 100644 --- a/xbmc/interfaces/json-rpc/FileOperations.cpp +++ b/xbmc/interfaces/json-rpc/FileOperations.cpp @@ -295,7 +295,7 @@ bool CFileOperations::FillFileItemList(const CVariant ¶meterObject, CFileIte CDirectory directory; if (directory.GetDirectory(strPath, items, extensions)) { - items.Sort(SORT_METHOD_FILE, SORT_ORDER_ASC); + items.Sort(SORT_METHOD_FILE, SortOrderAscending); CFileItemList filteredDirectories; for (unsigned int i = 0; i < (unsigned int)items.Size(); i++) { diff --git a/xbmc/interfaces/python/xbmcmodule/listitem.cpp b/xbmc/interfaces/python/xbmcmodule/listitem.cpp index bfc5f6f7b0f64..5898a4433a975 100644 --- a/xbmc/interfaces/python/xbmcmodule/listitem.cpp +++ b/xbmc/interfaces/python/xbmcmodule/listitem.cpp @@ -801,9 +801,9 @@ namespace PYXBMC else if (lowerKey.CompareNoCase("specialsort") == 0) { if (uText == "bottom") - self->item->SetSpecialSort(SORT_ON_BOTTOM); + self->item->SetSpecialSort(SortSpecialOnBottom); else if (uText == "top") - self->item->SetSpecialSort(SORT_ON_TOP); + self->item->SetSpecialSort(SortSpecialOnTop); } else self->item->SetProperty(lowerKey.ToLower(), uText.c_str()); diff --git a/xbmc/music/GUIViewStateMusic.cpp b/xbmc/music/GUIViewStateMusic.cpp index dff52ae6dfb57..55bbc3ca433e0 100644 --- a/xbmc/music/GUIViewStateMusic.cpp +++ b/xbmc/music/GUIViewStateMusic.cpp @@ -137,7 +137,7 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item SetViewAsControl(DEFAULT_VIEW_LIST); - SetSortOrder(SORT_ORDER_NONE); + SetSortOrder(SortOrderNone); } break; case NODE_TYPE_TOP100: @@ -147,7 +147,7 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item SetViewAsControl(DEFAULT_VIEW_LIST); - SetSortOrder(SORT_ORDER_NONE); + SetSortOrder(SortOrderNone); } break; case NODE_TYPE_GENRE: @@ -157,7 +157,7 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item SetViewAsControl(DEFAULT_VIEW_LIST); - SetSortOrder(SORT_ORDER_ASC); + SetSortOrder(SortOrderAscending); } break; case NODE_TYPE_YEAR: @@ -167,7 +167,7 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item SetViewAsControl(DEFAULT_VIEW_LIST); - SetSortOrder(SORT_ORDER_ASC); + SetSortOrder(SortOrderAscending); } break; case NODE_TYPE_ARTIST: @@ -221,7 +221,7 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item SetViewAsControl(g_settings.m_viewStateMusicNavAlbums.m_viewMode); - SetSortOrder(SORT_ORDER_NONE); + SetSortOrder(SortOrderNone); } break; case NODE_TYPE_ALBUM_RECENTLY_ADDED_SONGS: @@ -231,7 +231,7 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item SetViewAsControl(g_settings.m_viewStateMusicNavSongs.m_viewMode); - SetSortOrder(SORT_ORDER_NONE); + SetSortOrder(SortOrderNone); } break; case NODE_TYPE_ALBUM_RECENTLY_PLAYED: @@ -241,7 +241,7 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item SetViewAsControl(g_settings.m_viewStateMusicNavAlbums.m_viewMode); - SetSortOrder(SORT_ORDER_NONE); + SetSortOrder(SortOrderNone); } break; case NODE_TYPE_ALBUM_RECENTLY_PLAYED_SONGS: @@ -251,7 +251,7 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item SetViewAsControl(g_settings.m_viewStateMusicNavAlbums.m_viewMode); - SetSortOrder(SORT_ORDER_NONE); + SetSortOrder(SortOrderNone); } break; case NODE_TYPE_ALBUM_TOP100: @@ -261,7 +261,7 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item SetViewAsControl(DEFAULT_VIEW_LIST); - SetSortOrder(SORT_ORDER_NONE); + SetSortOrder(SortOrderNone); } break; case NODE_TYPE_SINGLES: @@ -333,7 +333,7 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item SetViewAsControl(g_settings.m_viewStateMusicNavSongs.m_viewMode); - SetSortOrder(SORT_ORDER_NONE); + SetSortOrder(SortOrderNone); } break; default: @@ -500,7 +500,7 @@ CGUIViewStateWindowMusicNav::CGUIViewStateWindowMusicNav(const CFileItemList& it SetViewAsControl(DEFAULT_VIEW_LIST); - SetSortOrder(SORT_ORDER_NONE); + SetSortOrder(SortOrderNone); } else { @@ -542,7 +542,7 @@ CGUIViewStateWindowMusicNav::CGUIViewStateWindowMusicNav(const CFileItemList& it } SetViewAsControl(DEFAULT_VIEW_LIST); - SetSortOrder(SORT_ORDER_ASC); + SetSortOrder(SortOrderAscending); } LoadViewState(items.GetPath(), WINDOW_MUSIC_NAV); } @@ -623,7 +623,7 @@ CGUIViewStateWindowMusicSongs::CGUIViewStateWindowMusicSongs(const CFileItemList SetViewAsControl(DEFAULT_VIEW_LIST); - SetSortOrder(SORT_ORDER_ASC); + SetSortOrder(SortOrderAscending); } else if (items.GetPath() == "special://musicplaylists/") { // playlists list sorts by label only, ignoring folders @@ -676,7 +676,7 @@ CGUIViewStateWindowMusicPlaylist::CGUIViewStateWindowMusicPlaylist(const CFileIt SetViewAsControl(DEFAULT_VIEW_LIST); - SetSortOrder(SORT_ORDER_NONE); + SetSortOrder(SortOrderNone); LoadViewState(items.GetPath(), WINDOW_MUSIC_PLAYLIST); } diff --git a/xbmc/music/infoscanner/MusicInfoScanner.cpp b/xbmc/music/infoscanner/MusicInfoScanner.cpp index b6523673adf3c..a508cfcfb8554 100644 --- a/xbmc/music/infoscanner/MusicInfoScanner.cpp +++ b/xbmc/music/infoscanner/MusicInfoScanner.cpp @@ -378,7 +378,7 @@ bool CMusicInfoScanner::DoScan(const CStdString& strDirectory) // sort and get the path hash. Note that we don't filter .cue sheet items here as we want // to detect changes in the .cue sheet as well. The .cue sheet items only need filtering // if we have a changed hash. - items.Sort(SORT_METHOD_LABEL, SORT_ORDER_ASC); + items.Sort(SORT_METHOD_LABEL, SortOrderAscending); CStdString hash; GetPathHash(items, hash); @@ -396,7 +396,7 @@ bool CMusicInfoScanner::DoScan(const CStdString& strDirectory) // filter items in the sub dir (for .cue sheet support) items.FilterCueItems(); - items.Sort(SORT_METHOD_LABEL, SORT_ORDER_ASC); + items.Sort(SORT_METHOD_LABEL, SortOrderAscending); // and then scan in the new information if (RetrieveMusicInfo(items, strDirectory) > 0) diff --git a/xbmc/music/windows/GUIWindowMusicBase.cpp b/xbmc/music/windows/GUIWindowMusicBase.cpp index 9a2f72e565d34..65cc0a5b00b7a 100644 --- a/xbmc/music/windows/GUIWindowMusicBase.cpp +++ b/xbmc/music/windows/GUIWindowMusicBase.cpp @@ -1336,14 +1336,14 @@ bool CGUIWindowMusicBase::GetDirectory(const CStdString &strDirectory, CFileItem newPlaylist.reset(new CFileItem("newplaylist://", false)); newPlaylist->SetLabel(g_localizeStrings.Get(525)); newPlaylist->SetLabelPreformated(true); - newPlaylist->SetSpecialSort(SORT_ON_BOTTOM); + newPlaylist->SetSpecialSort(SortSpecialOnBottom); newPlaylist->SetCanQueue(false); items.Add(newPlaylist); newPlaylist.reset(new CFileItem("newsmartplaylist://music", false)); newPlaylist->SetLabel(g_localizeStrings.Get(21437)); newPlaylist->SetLabelPreformated(true); - newPlaylist->SetSpecialSort(SORT_ON_BOTTOM); + newPlaylist->SetSpecialSort(SortSpecialOnBottom); newPlaylist->SetCanQueue(false); items.Add(newPlaylist); } diff --git a/xbmc/network/UPnP.cpp b/xbmc/network/UPnP.cpp index 912aa75f4bc61..3c77f0d444f97 100644 --- a/xbmc/network/UPnP.cpp +++ b/xbmc/network/UPnP.cpp @@ -1108,7 +1108,7 @@ CUPnPServer::OnBrowseDirectChildren(PLT_ActionReference& action, } // Always sort by label - items.Sort(SORT_METHOD_LABEL, SORT_ORDER_ASC); + items.Sort(SORT_METHOD_LABEL, SortOrderAscending); // Don't pass parent_id if action is Search not BrowseDirectChildren, as // we want the engine to determine the best parent id, not necessarily the one diff --git a/xbmc/pictures/GUIViewStatePictures.cpp b/xbmc/pictures/GUIViewStatePictures.cpp index 15e65cd3c6efa..5ddda6da2315a 100644 --- a/xbmc/pictures/GUIViewStatePictures.cpp +++ b/xbmc/pictures/GUIViewStatePictures.cpp @@ -44,7 +44,7 @@ CGUIViewStateWindowPictures::CGUIViewStateWindowPictures(const CFileItemList& it SetViewAsControl(DEFAULT_VIEW_LIST); - SetSortOrder(SORT_ORDER_ASC); + SetSortOrder(SortOrderAscending); } else { diff --git a/xbmc/pictures/GUIWindowSlideShow.cpp b/xbmc/pictures/GUIWindowSlideShow.cpp index a325c63203551..947dbcdf6965e 100644 --- a/xbmc/pictures/GUIWindowSlideShow.cpp +++ b/xbmc/pictures/GUIWindowSlideShow.cpp @@ -913,7 +913,7 @@ int CGUIWindowSlideShow::CurrentSlide() const void CGUIWindowSlideShow::AddFromPath(const CStdString &strPath, bool bRecursive, - SORT_METHOD method, SORT_ORDER order, const CStdString &strExtensions) + SORT_METHOD method, SortOrder order, const CStdString &strExtensions) { if (strPath!="") { @@ -933,7 +933,7 @@ void CGUIWindowSlideShow::AddFromPath(const CStdString &strPath, void CGUIWindowSlideShow::RunSlideShow(const CStdString &strPath, bool bRecursive /* = false */, bool bRandom /* = false */, bool bNotRandom /* = false */, SORT_METHOD method /* = SORT_METHOD_LABEL */, - SORT_ORDER order /* = SORT_ORDER_ASC */, const CStdString &strExtensions) + SortOrder order /* = SortOrderAscending */, const CStdString &strExtensions) { // stop any video if (g_application.IsPlayingVideo()) @@ -955,7 +955,7 @@ void CGUIWindowSlideShow::RunSlideShow(const CStdString &strPath, g_windowManager.ActivateWindow(WINDOW_SLIDESHOW); } -void CGUIWindowSlideShow::AddItems(const CStdString &strPath, path_set *recursivePaths, SORT_METHOD method, SORT_ORDER order) +void CGUIWindowSlideShow::AddItems(const CStdString &strPath, path_set *recursivePaths, SORT_METHOD method, SortOrder order) { // check whether we've already added this path if (recursivePaths) diff --git a/xbmc/pictures/GUIWindowSlideShow.h b/xbmc/pictures/GUIWindowSlideShow.h index 27b7eeb5419b0..18a2b433fe9f4 100644 --- a/xbmc/pictures/GUIWindowSlideShow.h +++ b/xbmc/pictures/GUIWindowSlideShow.h @@ -76,10 +76,10 @@ class CGUIWindowSlideShow : public CGUIWindow void RunSlideShow(const CStdString &strPath, bool bRecursive = false, bool bRandom = false, bool bNotRandom = false, SORT_METHOD method = SORT_METHOD_LABEL, - SORT_ORDER order = SORT_ORDER_ASC, const CStdString &strExtensions=""); + SortOrder order = SortOrderAscending, const CStdString &strExtensions=""); void AddFromPath(const CStdString &strPath, bool bRecursive, SORT_METHOD method=SORT_METHOD_LABEL, - SORT_ORDER order=SORT_ORDER_ASC, const CStdString &strExtensions=""); + SortOrder order = SortOrderAscending, const CStdString &strExtensions=""); void StartSlideShow(bool screensaver=false); bool InSlideShow() const; virtual bool OnMessage(CGUIMessage& message); @@ -98,8 +98,8 @@ class CGUIWindowSlideShow : public CGUIWindow private: typedef std::set path_set; // set to track which paths we're adding void AddItems(const CStdString &strPath, path_set *recursivePaths, - SORT_METHOD method=SORT_METHOD_LABEL, - SORT_ORDER order=SORT_ORDER_ASC); + SORT_METHOD method = SORT_METHOD_LABEL, + SortOrder order = SortOrderAscending); void RenderPause(); void RenderErrorMessage(); void Rotate(); diff --git a/xbmc/pictures/PictureThumbLoader.cpp b/xbmc/pictures/PictureThumbLoader.cpp index 2f06d9f86c5b0..0bb08640d4b81 100644 --- a/xbmc/pictures/PictureThumbLoader.cpp +++ b/xbmc/pictures/PictureThumbLoader.cpp @@ -206,7 +206,7 @@ void CPictureThumbLoader::ProcessFoldersAndArchives(CFileItem *pItem) if (items.Size() < 4 || pItem->IsCBR() || pItem->IsCBZ()) { // less than 4 items, so just grab the first thumb - items.Sort(SORT_METHOD_LABEL, SORT_ORDER_ASC); + items.Sort(SORT_METHOD_LABEL, SortOrderAscending); CStdString thumb = CTextureCache::GetWrappedThumbURL(items[0]->GetPath()); db.SetTextureForPath(pItem->GetPath(), "thumb", thumb); CTextureCache::Get().BackgroundCacheImage(thumb); diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp index f25343572a4a3..3b0a2978bd078 100644 --- a/xbmc/settings/Settings.cpp +++ b/xbmc/settings/Settings.cpp @@ -458,8 +458,8 @@ void CSettings::GetViewState(const TiXmlElement *pRootElement, const CStdString viewState.m_sortMethod = (SORT_METHOD)sortMethod; int sortOrder; - GetInteger(pNode, "sortorder", sortOrder, SORT_ORDER_ASC, SORT_ORDER_NONE, SORT_ORDER_DESC); - viewState.m_sortOrder = (SORT_ORDER)sortOrder; + GetInteger(pNode, "sortorder", sortOrder, SortOrderAscending, SortOrderNone, SortOrderDescending); + viewState.m_sortOrder = (SortOrder)sortOrder; } void CSettings::SetViewState(TiXmlNode *pRootNode, const CStdString &strTagName, const CViewState &viewState) const diff --git a/xbmc/storage/MediaManager.cpp b/xbmc/storage/MediaManager.cpp index 7bcf3dd2d6fd6..c5db51b8f8511 100644 --- a/xbmc/storage/MediaManager.cpp +++ b/xbmc/storage/MediaManager.cpp @@ -541,7 +541,7 @@ bool CMediaManager::HashDVD(const CStdString& dvdpath, uint32_t& crc) Crc32 crc32; bool dataRead = false; - vecItemsTS.Sort(SORT_METHOD_FILE, SORT_ORDER_ASC); + vecItemsTS.Sort(SORT_METHOD_FILE, SortOrderAscending); for (int i = 0; i < vecItemsTS.Size(); i++) { CFileItemPtr videoTSItem = vecItemsTS[i]; diff --git a/xbmc/video/GUIViewStateVideo.cpp b/xbmc/video/GUIViewStateVideo.cpp index 111fe81e9f57d..d251a01929c56 100644 --- a/xbmc/video/GUIViewStateVideo.cpp +++ b/xbmc/video/GUIViewStateVideo.cpp @@ -67,7 +67,7 @@ CGUIViewStateWindowVideoFiles::CGUIViewStateWindowVideoFiles(const CFileItemList SetViewAsControl(DEFAULT_VIEW_LIST); - SetSortOrder(SORT_ORDER_ASC); + SetSortOrder(SortOrderAscending); } else { @@ -106,7 +106,7 @@ CGUIViewStateWindowVideoNav::CGUIViewStateWindowVideoNav(const CFileItemList& it SetViewAsControl(DEFAULT_VIEW_LIST); - SetSortOrder(SORT_ORDER_NONE); + SetSortOrder(SortOrderNone); } else if (items.IsVideoDb()) { @@ -127,7 +127,7 @@ CGUIViewStateWindowVideoNav::CGUIViewStateWindowVideoNav(const CFileItemList& it SetViewAsControl(DEFAULT_VIEW_LIST); - SetSortOrder(SORT_ORDER_NONE); + SetSortOrder(SortOrderNone); } break; case NODE_TYPE_DIRECTOR: @@ -253,7 +253,7 @@ CGUIViewStateWindowVideoNav::CGUIViewStateWindowVideoNav(const CFileItemList& it SetSortMethod(SORT_METHOD_NONE); SetViewAsControl(g_settings.m_viewStateVideoNavEpisodes.m_viewMode); - SetSortOrder(SORT_ORDER_NONE); + SetSortOrder(SortOrderNone); break; } @@ -335,7 +335,7 @@ CGUIViewStateWindowVideoNav::CGUIViewStateWindowVideoNav(const CFileItemList& it SetViewAsControl(g_settings.m_viewStateVideoNavTitles.m_viewMode); - SetSortOrder(SORT_ORDER_NONE); + SetSortOrder(SortOrderNone); } break; case NODE_TYPE_RECENTLY_ADDED_MUSICVIDEOS: @@ -345,7 +345,7 @@ CGUIViewStateWindowVideoNav::CGUIViewStateWindowVideoNav(const CFileItemList& it SetViewAsControl(g_settings.m_viewStateVideoNavMusicVideos.m_viewMode); - SetSortOrder(SORT_ORDER_NONE); + SetSortOrder(SortOrderNone); } break; default: @@ -451,7 +451,7 @@ CGUIViewStateWindowVideoPlaylist::CGUIViewStateWindowVideoPlaylist(const CFileIt SetViewAsControl(DEFAULT_VIEW_LIST); - SetSortOrder(SORT_ORDER_NONE); + SetSortOrder(SortOrderNone); LoadViewState(items.GetPath(), WINDOW_VIDEO_PLAYLIST); } diff --git a/xbmc/video/VideoInfoScanner.cpp b/xbmc/video/VideoInfoScanner.cpp index ad63237431b5c..44a547365c552 100644 --- a/xbmc/video/VideoInfoScanner.cpp +++ b/xbmc/video/VideoInfoScanner.cpp @@ -673,7 +673,7 @@ namespace VIDEO */ // since we're doing this now anyway, should other items be stacked? - items.Sort(SORT_METHOD_FULLPATH, SORT_ORDER_ASC); + items.Sort(SORT_METHOD_FULLPATH, SortOrderAscending); int x = 0; while (x < items.Size()) { diff --git a/xbmc/video/windows/GUIWindowVideoBase.cpp b/xbmc/video/windows/GUIWindowVideoBase.cpp index 3c0052a7e39e7..a39bf6904d6d0 100644 --- a/xbmc/video/windows/GUIWindowVideoBase.cpp +++ b/xbmc/video/windows/GUIWindowVideoBase.cpp @@ -1993,7 +1993,7 @@ void CGUIWindowVideoBase::AppendAndClearSearchItems(CFileItemList &searchItems, if (!searchItems.Size()) return; - searchItems.Sort(g_guiSettings.GetBool("filelists.ignorethewhensorting") ? SORT_METHOD_LABEL_IGNORE_THE : SORT_METHOD_LABEL, SORT_ORDER_ASC); + searchItems.Sort(g_guiSettings.GetBool("filelists.ignorethewhensorting") ? SORT_METHOD_LABEL_IGNORE_THE : SORT_METHOD_LABEL, SortOrderAscending); for (int i = 0; i < searchItems.Size(); i++) searchItems[i]->SetLabel(prependLabel + searchItems[i]->GetLabel()); results.Append(searchItems); diff --git a/xbmc/video/windows/GUIWindowVideoNav.cpp b/xbmc/video/windows/GUIWindowVideoNav.cpp index f5f4173f75fdf..32b07a45d205a 100644 --- a/xbmc/video/windows/GUIWindowVideoNav.cpp +++ b/xbmc/video/windows/GUIWindowVideoNav.cpp @@ -1327,7 +1327,7 @@ void CGUIWindowVideoNav::OnLinkMovieToTvShow(int itemnumber, bool bRemove) int iSelectedLabel = 0; if (list.Size() > 1) { - list.Sort(g_guiSettings.GetBool("filelists.ignorethewhensorting") ? SORT_METHOD_LABEL_IGNORE_THE : SORT_METHOD_LABEL, SORT_ORDER_ASC); + list.Sort(g_guiSettings.GetBool("filelists.ignorethewhensorting") ? SORT_METHOD_LABEL_IGNORE_THE : SORT_METHOD_LABEL, SortOrderAscending); CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT); pDialog->Reset(); pDialog->SetItems(&list); diff --git a/xbmc/windows/GUIMediaWindow.cpp b/xbmc/windows/GUIMediaWindow.cpp index ac17438305889..8d398ed8994b4 100644 --- a/xbmc/windows/GUIMediaWindow.cpp +++ b/xbmc/windows/GUIMediaWindow.cpp @@ -515,14 +515,14 @@ void CGUIMediaWindow::UpdateButtons() if (m_guiState.get()) { // Update sorting controls - if (m_guiState->GetDisplaySortOrder()==SORT_ORDER_NONE) + if (m_guiState->GetDisplaySortOrder() == SortOrderNone) { CONTROL_DISABLE(CONTROL_BTNSORTASC); } else { CONTROL_ENABLE(CONTROL_BTNSORTASC); - if (m_guiState->GetDisplaySortOrder()==SORT_ORDER_ASC) + if (m_guiState->GetDisplaySortOrder() == SortOrderAscending) { CGUIMessage msg(GUI_MSG_DESELECTED, GetID(), CONTROL_BTNSORTASC); g_windowManager.SendMessage(msg); @@ -770,7 +770,7 @@ bool CGUIMediaWindow::Update(const CStdString &strDirectory) pItem->SetLabel(strLabel); pItem->SetLabelPreformated(true); pItem->m_bIsFolder = true; - pItem->SetSpecialSort(SORT_ON_BOTTOM); + pItem->SetSpecialSort(SortSpecialOnBottom); m_vecItems->Add(pItem); } m_iLastControl = GetFocusedControlID(); diff --git a/xbmc/windows/GUIWindowFileManager.cpp b/xbmc/windows/GUIWindowFileManager.cpp index e9d88963c8500..d434812239055 100644 --- a/xbmc/windows/GUIWindowFileManager.cpp +++ b/xbmc/windows/GUIWindowFileManager.cpp @@ -345,7 +345,7 @@ void CGUIWindowFileManager::OnSort(int iList) } - m_vecItems[iList]->Sort(SORT_METHOD_LABEL, SORT_ORDER_ASC); + m_vecItems[iList]->Sort(SORT_METHOD_LABEL, SortOrderAscending); } void CGUIWindowFileManager::ClearFileItems(int iList) @@ -486,7 +486,7 @@ bool CGUIWindowFileManager::Update(int iList, const CStdString &strDirectory) pItem->SetLabel(strLabel); pItem->SetLabelPreformated(true); pItem->m_bIsFolder = true; - pItem->SetSpecialSort(SORT_ON_BOTTOM); + pItem->SetSpecialSort(SortSpecialOnBottom); m_vecItems[iList]->Add(pItem); } else if (items.IsEmpty() || g_guiSettings.GetBool("filelists.showparentdiritems"))