Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #2959 from Montellese/sorting_cleanup

cleanup sorting to (almost) get rid of the old SORT_METHOD_FOO
  • Loading branch information...
commit 6edea14c9723738fc87ad9905fb6437304508881 2 parents 66afb93 + 7ec41ee
@Montellese Montellese authored
Showing with 700 additions and 764 deletions.
  1. +6 −6 xbmc/Autorun.cpp
  2. +64 −41 xbmc/FileItem.cpp
  3. +7 −6 xbmc/FileItem.h
  4. +3 −5 xbmc/GUIInfoManager.cpp
  5. +0 −10 xbmc/SortFileItem.h
  6. +3 −3 xbmc/addons/AddonInstaller.cpp
  7. +1 −1  xbmc/addons/GUIDialogAddonInfo.cpp
  8. +3 −3 xbmc/addons/GUIViewStateAddonBrowser.cpp
  9. +1 −1  xbmc/addons/GUIWindowAddonBrowser.cpp
  10. +1 −1  xbmc/dialogs/GUIDialogFileBrowser.cpp
  11. +1 −1  xbmc/dialogs/GUIDialogMediaFilter.cpp
  12. +1 −1  xbmc/dialogs/GUIDialogSelect.cpp
  13. +1 −1  xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp
  14. +2 −2 xbmc/filesystem/BlurayDirectory.cpp
  15. +3 −11 xbmc/filesystem/HTSPDirectory.cpp
  16. +1 −1  xbmc/filesystem/LibraryDirectory.cpp
  17. +1 −1  xbmc/filesystem/MultiPathDirectory.cpp
  18. +9 −20 xbmc/filesystem/MythDirectory.cpp
  19. +1 −1  xbmc/filesystem/PVRDirectory.cpp
  20. +35 −61 xbmc/filesystem/PluginDirectory.cpp
  21. +1 −0  xbmc/filesystem/PluginDirectory.h
  22. +4 −4 xbmc/filesystem/RSSDirectory.cpp
  23. +1 −1  xbmc/filesystem/RarManager.cpp
  24. +1 −1  xbmc/filesystem/SmartPlaylistDirectory.cpp
  25. +4 −4 xbmc/filesystem/UPnPDirectory.cpp
  26. +6 −6 xbmc/filesystem/test/TestRarFile.cpp
  27. +2 −2 xbmc/input/ButtonTranslator.cpp
  28. +3 −3 xbmc/interfaces/json-rpc/AudioLibrary.cpp
  29. +1 −1  xbmc/interfaces/json-rpc/FileOperations.cpp
  30. +119 −185 xbmc/music/GUIViewStateMusic.cpp
  31. +2 −2 xbmc/music/infoscanner/MusicInfoScanner.cpp
  32. +22 −18 xbmc/network/upnp/UPnPServer.cpp
  33. +10 −10 xbmc/pictures/GUIViewStatePictures.cpp
  34. +9 −6 xbmc/pictures/GUIWindowPictures.cpp
  35. +11 −9 xbmc/pictures/GUIWindowSlideShow.cpp
  36. +11 −6 xbmc/pictures/GUIWindowSlideShow.h
  37. +1 −1  xbmc/pictures/PictureThumbLoader.cpp
  38. +4 −6 xbmc/programs/GUIViewStatePrograms.cpp
  39. +5 −8 xbmc/pvr/windows/GUIViewStatePVR.cpp
  40. +13 −10 xbmc/pvr/windows/GUIWindowPVRCommon.cpp
  41. +2 −1  xbmc/pvr/windows/GUIWindowPVRCommon.h
  42. +2 −2 xbmc/pvr/windows/GUIWindowPVRRecordings.cpp
  43. +1 −1  xbmc/pvr/windows/GUIWindowPVRSearch.cpp
  44. +1 −1  xbmc/pvr/windows/GUIWindowPVRTimers.cpp
  45. +8 −0 xbmc/utils/SortUtils.h
  46. +137 −186 xbmc/video/GUIViewStateVideo.cpp
  47. +3 −3 xbmc/video/VideoDatabase.cpp
  48. +1 −1  xbmc/video/VideoInfoScanner.cpp
  49. +2 −2 xbmc/video/windows/GUIWindowVideoBase.cpp
  50. +4 −4 xbmc/video/windows/GUIWindowVideoNav.cpp
  51. +65 −57 xbmc/view/GUIViewState.cpp
  52. +7 −5 xbmc/view/GUIViewState.h
  53. +52 −5 xbmc/view/ViewDatabase.cpp
  54. +1 −1  xbmc/view/ViewDatabase.h
  55. +7 −7 xbmc/view/ViewState.h
  56. +22 −8 xbmc/view/ViewStateSettings.cpp
  57. +1 −1  xbmc/view/ViewStateSettings.h
  58. +9 −18 xbmc/windows/GUIMediaWindow.cpp
  59. +1 −1  xbmc/windows/GUIWindowFileManager.cpp
View
12 xbmc/Autorun.cpp
@@ -138,7 +138,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
}
// Sorting necessary for easier HDDVD handling
- vecItems.Sort(SORT_METHOD_LABEL, SortOrderAscending);
+ vecItems.Sort(SortByLabel, SortOrderAscending);
bool bAllowVideo = true;
// bool bAllowPictures = true;
@@ -220,7 +220,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
{
// HD DVD Standard says the highest numbered playlist has to be handled first.
CLog::Log(LOGINFO,"HD DVD: Playlist found. Set filetypes to *.xpl for external player.");
- items.Sort(SORT_METHOD_LABEL, SortOrderDescending);
+ items.Sort(SortByLabel, SortOrderDescending);
phddvdItem = pItem;
hddvdname = URIUtils::GetFileName(items[0]->GetPath());
CLog::Log(LOGINFO,"HD DVD: %s", items[0]->GetPath().c_str());
@@ -240,7 +240,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
{
// HD DVD Standard says the lowest numbered ifo has to be handled first.
CLog::Log(LOGINFO,"HD DVD: IFO found. Set filename to HV* and filetypes to *.ifo for external player.");
- items.Sort(SORT_METHOD_LABEL, SortOrderAscending);
+ items.Sort(SortByLabel, SortOrderAscending);
phddvdItem = pItem;
hddvdname = URIUtils::GetFileName(items[0]->GetPath());
CLog::Log(LOGINFO,"HD DVD: %s",items[0]->GetPath().c_str());
@@ -253,7 +253,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
if (items.Size())
{
// Sort *.evo files in alphabetical order.
- items.Sort(SORT_METHOD_LABEL, SortOrderAscending);
+ items.Sort(SortByLabel, SortOrderAscending);
int64_t asize = 0;
int ecount = 0;
// calculate average size of elements above 1gb
@@ -269,7 +269,7 @@ bool CAutorun::RunDisc(IDirectory* pDir, const CStdString& strDrive, int& nAdded
if (items[j]->m_dwSize >= asize)
sitems.Add (items[j]);
// Sort *.evo files by size.
- items.Sort(SORT_METHOD_SIZE, SortOrderDescending);
+ items.Sort(SortBySize, SortOrderDescending);
// Add other files with descending size to bottom of new list.
for (int j = 0; j < items.Size(); j++)
if (items[j]->m_dwSize < asize)
@@ -329,7 +329,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, SortOrderAscending);
+ items.Sort(SortByLabel, SortOrderAscending);
g_playlistPlayer.ClearPlaylist(PLAYLIST_VIDEO);
g_playlistPlayer.Add(PLAYLIST_VIDEO, items);
g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_VIDEO);
View
105 xbmc/FileItem.cpp
@@ -1532,8 +1532,6 @@ CFileItemList::CFileItemList()
m_fastLookup = false;
m_bIsFolder = true;
m_cacheToDisc = CACHE_IF_SLOW;
- m_sortMethod = SORT_METHOD_NONE;
- m_sortOrder = SortOrderNone;
m_sortIgnoreFolders = false;
m_replaceListing = false;
}
@@ -1542,8 +1540,6 @@ CFileItemList::CFileItemList(const CStdString& strPath) : CFileItem(strPath, tru
{
m_fastLookup = false;
m_cacheToDisc = CACHE_IF_SLOW;
- m_sortMethod = SORT_METHOD_NONE;
- m_sortOrder = SortOrderNone;
m_sortIgnoreFolders = false;
m_replaceListing = false;
}
@@ -1613,8 +1609,9 @@ void CFileItemList::Clear()
CSingleLock lock(m_lock);
ClearItems();
- m_sortMethod = SORT_METHOD_NONE;
- m_sortOrder = SortOrderNone;
+ m_sortDescription.sortBy = SortByNone;
+ m_sortDescription.sortOrder = SortOrderNone;
+ m_sortDescription.sortAttributes = SortAttributeNone;
m_sortIgnoreFolders = false;
m_cacheToDisc = CACHE_IF_SLOW;
m_sortDetails.clear();
@@ -1715,8 +1712,7 @@ void CFileItemList::Assign(const CFileItemList& itemlist, bool append)
SetPath(itemlist.GetPath());
SetLabel(itemlist.GetLabel());
m_sortDetails = itemlist.m_sortDetails;
- m_sortMethod = itemlist.m_sortMethod;
- m_sortOrder = itemlist.m_sortOrder;
+ m_sortDescription = itemlist.m_sortDescription;
m_replaceListing = itemlist.m_replaceListing;
m_content = itemlist.m_content;
m_mapProperties = itemlist.m_mapProperties;
@@ -1729,13 +1725,12 @@ bool CFileItemList::Copy(const CFileItemList& items, bool copyItems /* = true */
*(CFileItem*)this = *(CFileItem*)&items;
// assign the rest of the CFileItemList properties
- m_replaceListing = items.m_replaceListing;
- m_content = items.m_content;
- m_mapProperties = items.m_mapProperties;
- m_cacheToDisc = items.m_cacheToDisc;
- m_sortDetails = items.m_sortDetails;
- m_sortMethod = items.m_sortMethod;
- m_sortOrder = items.m_sortOrder;
+ m_replaceListing = items.m_replaceListing;
+ m_content = items.m_content;
+ m_mapProperties = items.m_mapProperties;
+ m_cacheToDisc = items.m_cacheToDisc;
+ m_sortDetails = items.m_sortDetails;
+ m_sortDescription = items.m_sortDescription;
m_sortIgnoreFolders = items.m_sortIgnoreFolders;
if (copyItems)
@@ -1847,26 +1842,24 @@ void CFileItemList::FillSortFields(FILEITEMFILLFUNC func)
std::for_each(m_items.begin(), m_items.end(), func);
}
-void CFileItemList::Sort(SORT_METHOD sortMethod, SortOrder sortOrder)
+void CFileItemList::Sort(SortBy sortBy, SortOrder sortOrder, SortAttribute sortAttributes /* = SortAttributeNone */)
{
- // Already sorted?
- if (sortMethod == m_sortMethod && m_sortOrder == sortOrder)
+ if (sortBy == SortByNone ||
+ (m_sortDescription.sortBy == sortBy && m_sortDescription.sortOrder == sortOrder &&
+ m_sortDescription.sortAttributes == sortAttributes))
return;
- SortDescription sorting = SortUtils::TranslateOldSortMethod(sortMethod);
+ SortDescription sorting;
+ sorting.sortBy = sortBy;
sorting.sortOrder = sortOrder;
+ sorting.sortAttributes = sortAttributes;
Sort(sorting);
-
- m_sortMethod = sortMethod;
- m_sortOrder = sortOrder;
+ m_sortDescription = sorting;
}
void CFileItemList::Sort(SortDescription sortDescription)
{
- if (sortDescription.sortBy == SortByNone)
- return;
-
if (sortDescription.sortBy == SortByFile ||
sortDescription.sortBy == SortBySortTitle ||
sortDescription.sortBy == SortByDateAdded ||
@@ -1877,6 +1870,11 @@ void CFileItemList::Sort(SortDescription sortDescription)
sortDescription.sortBy == SortByPlaycount)
sortDescription.sortAttributes = (SortAttribute)((int)sortDescription.sortAttributes | SortAttributeIgnoreFolders);
+ if (sortDescription.sortBy == SortByNone ||
+ (m_sortDescription.sortBy == sortDescription.sortBy && m_sortDescription.sortOrder == sortDescription.sortOrder &&
+ m_sortDescription.sortAttributes == sortDescription.sortAttributes))
+ return;
+
if (m_sortIgnoreFolders)
sortDescription.sortAttributes = (SortAttribute)((int)sortDescription.sortAttributes | SortAttributeIgnoreFolders);
@@ -1927,8 +1925,9 @@ void CFileItemList::Archive(CArchive& ar)
ar << m_fastLookup;
- ar << (int)m_sortMethod;
- ar << (int)m_sortOrder;
+ ar << (int)m_sortDescription.sortBy;
+ ar << (int)m_sortDescription.sortOrder;
+ ar << (int)m_sortDescription.sortAttributes;
ar << m_sortIgnoreFolders;
ar << (int)m_cacheToDisc;
@@ -1936,7 +1935,9 @@ void CFileItemList::Archive(CArchive& ar)
for (unsigned int j = 0; j < m_sortDetails.size(); ++j)
{
const SORT_METHOD_DETAILS &details = m_sortDetails[j];
- ar << (int)details.m_sortMethod;
+ ar << (int)details.m_sortDescription.sortBy;
+ ar << (int)details.m_sortDescription.sortOrder;
+ ar << (int)details.m_sortDescription.sortAttributes;
ar << details.m_buttonLabel;
ar << details.m_labelMasks.m_strLabelFile;
ar << details.m_labelMasks.m_strLabelFolder;
@@ -1986,9 +1987,11 @@ void CFileItemList::Archive(CArchive& ar)
int tempint;
ar >> (int&)tempint;
- m_sortMethod = SORT_METHOD(tempint);
+ m_sortDescription.sortBy = (SortBy)tempint;
+ ar >> (int&)tempint;
+ m_sortDescription.sortOrder = (SortOrder)tempint;
ar >> (int&)tempint;
- m_sortOrder = SortOrder(tempint);
+ m_sortDescription.sortAttributes = (SortAttribute)tempint;
ar >> m_sortIgnoreFolders;
ar >> (int&)tempint;
m_cacheToDisc = CACHE_TYPE(tempint);
@@ -1999,7 +2002,11 @@ void CFileItemList::Archive(CArchive& ar)
{
SORT_METHOD_DETAILS details;
ar >> (int&)tempint;
- details.m_sortMethod = SORT_METHOD(tempint);
+ details.m_sortDescription.sortBy = (SortBy)tempint;
+ ar >> (int&)tempint;
+ details.m_sortDescription.sortOrder = (SortOrder)tempint;
+ ar >> (int&)tempint;
+ details.m_sortDescription.sortAttributes = (SortAttribute)tempint;
ar >> details.m_buttonLabel;
ar >> details.m_labelMasks.m_strLabelFile;
ar >> details.m_labelMasks.m_strLabelFolder;
@@ -2245,7 +2252,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, SortOrderAscending);
+ Sort(SortByLabel, SortOrderAscending);
StackFolders();
@@ -2364,7 +2371,7 @@ void CFileItemList::StackFolders()
item->SetPath(dvdPath);
item->SetLabel2("");
item->SetLabelPreformated(true);
- m_sortMethod = SORT_METHOD_NONE; /* sorting is now broken */
+ m_sortDescription.sortBy = SortByNone; /* sorting is now broken */
}
}
}
@@ -2558,7 +2565,8 @@ bool CFileItemList::Load(int windowID)
CLog::Log(LOGDEBUG,"Loading fileitems [%s]",GetPath().c_str());
CArchive ar(&file, CArchive::load);
ar >> *this;
- CLog::Log(LOGDEBUG," -- items: %i, directory: %s sort method: %i, ascending: %s",Size(),GetPath().c_str(), m_sortMethod, m_sortOrder ? "true" : "false");
+ CLog::Log(LOGDEBUG," -- items: %i, directory: %s sort method: %i, ascending: %s", Size(), GetPath().c_str(), m_sortDescription.sortBy,
+ m_sortDescription.sortOrder == SortOrderAscending ? "true" : "false");
ar.Close();
file.Close();
return true;
@@ -2580,7 +2588,7 @@ bool CFileItemList::Save(int windowID)
{
CArchive ar(&file, CArchive::store);
ar << *this;
- CLog::Log(LOGDEBUG," -- items: %i, sort method: %i, ascending: %s",iSize,m_sortMethod, m_sortOrder ? "true" : "false");
+ CLog::Log(LOGDEBUG," -- items: %i, sort method: %i, ascending: %s", iSize, m_sortDescription.sortBy, m_sortDescription.sortOrder == SortOrderAscending ? "true" : "false");
ar.Close();
file.Close();
return true;
@@ -3070,12 +3078,26 @@ bool CFileItemList::UpdateItem(const CFileItem *item)
return false;
}
-void CFileItemList::AddSortMethod(SORT_METHOD sortMethod, int buttonLabel, const LABEL_MASKS &labelMasks)
+void CFileItemList::AddSortMethod(SortBy sortBy, int buttonLabel, const LABEL_MASKS &labelMasks, SortAttribute sortAttributes /* = SortAttributeNone */)
+{
+ AddSortMethod(sortBy, sortAttributes, buttonLabel, labelMasks);
+}
+
+void CFileItemList::AddSortMethod(SortBy sortBy, SortAttribute sortAttributes, int buttonLabel, const LABEL_MASKS &labelMasks)
+{
+ SortDescription sorting;
+ sorting.sortBy = sortBy;
+ sorting.sortAttributes = sortAttributes;
+
+ AddSortMethod(sorting, buttonLabel, labelMasks);
+}
+
+void CFileItemList::AddSortMethod(SortDescription sortDescription, int buttonLabel, const LABEL_MASKS &labelMasks)
{
SORT_METHOD_DETAILS sort;
- sort.m_sortMethod=sortMethod;
- sort.m_buttonLabel=buttonLabel;
- sort.m_labelMasks=labelMasks;
+ sort.m_sortDescription = sortDescription;
+ sort.m_buttonLabel = buttonLabel;
+ sort.m_labelMasks = labelMasks;
m_sortDetails.push_back(sort);
}
@@ -3087,8 +3109,9 @@ void CFileItemList::SetReplaceListing(bool replace)
void CFileItemList::ClearSortState()
{
- m_sortMethod = SORT_METHOD_NONE;
- m_sortOrder = SortOrderNone;
+ m_sortDescription.sortBy = SortByNone;
+ m_sortDescription.sortOrder = SortOrderNone;
+ m_sortDescription.sortAttributes = SortAttributeNone;
}
CVideoInfoTag* CFileItem::GetVideoInfoTag()
View
13 xbmc/FileItem.h
@@ -517,7 +517,7 @@ class CFileItemList : public CFileItem
void Assign(const CFileItemList& itemlist, bool append = false);
bool Copy (const CFileItemList& item, bool copyItems = true);
void Reserve(int iCount);
- void Sort(SORT_METHOD sortMethod, SortOrder sortOrder);
+ void Sort(SortBy sortBy, SortOrder sortOrder, SortAttribute sortAttributes = SortAttributeNone);
/* \brief Sorts the items based on the given sorting options
In contrast to Sort (see above) this does not change the internal
@@ -545,8 +545,8 @@ class CFileItemList : public CFileItem
*/
void Stack(bool stackFiles = true);
- SortOrder GetSortOrder() const { return m_sortOrder; }
- SORT_METHOD GetSortMethod() const { return m_sortMethod; }
+ SortOrder GetSortOrder() const { return m_sortDescription.sortOrder; }
+ SortBy GetSortMethod() const { return m_sortDescription.sortBy; }
/*! \brief load a CFileItemList out of the cache
The file list may be cached based on which window we're viewing in, as different
@@ -593,7 +593,9 @@ class CFileItemList : public CFileItem
*/
bool UpdateItem(const CFileItem *item);
- void AddSortMethod(SORT_METHOD method, int buttonLabel, const LABEL_MASKS &labelMasks);
+ void AddSortMethod(SortBy sortBy, int buttonLabel, const LABEL_MASKS &labelMasks, SortAttribute sortAttributes = SortAttributeNone);
+ void AddSortMethod(SortBy sortBy, SortAttribute sortAttributes, int buttonLabel, const LABEL_MASKS &labelMasks);
+ void AddSortMethod(SortDescription sortDescription, int buttonLabel, const LABEL_MASKS &labelMasks);
bool HasSortDetails() const { return m_sortDetails.size() != 0; };
const std::vector<SORT_METHOD_DETAILS> &GetSortDetails() const { return m_sortDetails; };
@@ -630,8 +632,7 @@ class CFileItemList : public CFileItem
VECFILEITEMS m_items;
MAPFILEITEMS m_map;
bool m_fastLookup;
- SORT_METHOD m_sortMethod;
- SortOrder m_sortOrder;
+ SortDescription m_sortDescription;
bool m_sortIgnoreFolders;
CACHE_TYPE m_cacheToDisc;
bool m_replaceListing;
View
8 xbmc/GUIInfoManager.cpp
@@ -1046,10 +1046,8 @@ int CGUIInfoManager::TranslateSingleString(const CStdString &strCondition)
}
else if (prop.name == "sort")
{
- SORT_METHOD sort = SORT_METHOD_NONE;
- if (prop.param().Equals("songrating")) sort = SORT_METHOD_SONG_RATING;
- if (sort != SORT_METHOD_NONE)
- return AddMultiInfo(GUIInfo(CONTAINER_SORT_METHOD, sort));
+ if (prop.param().Equals("songrating"))
+ return AddMultiInfo(GUIInfo(CONTAINER_SORT_METHOD, SortByRating));
}
}
else if (cat.name == "listitem")
@@ -2867,7 +2865,7 @@ bool CGUIInfoManager::GetMultiInfoBool(const GUIInfo &info, int contextWindow, c
{
const CGUIViewState *viewState = ((CGUIMediaWindow*)window)->GetViewState();
if (viewState)
- bReturn = ((unsigned int)viewState->GetSortMethod() == info.GetData1());
+ bReturn = ((unsigned int)viewState->GetSortMethod().sortBy == info.GetData1());
}
break;
}
View
10 xbmc/SortFileItem.h
@@ -19,8 +19,6 @@
*
*/
-#include "utils/LabelFormatter.h"
-
typedef enum {
SORT_METHOD_NONE=0,
SORT_METHOD_LABEL,
@@ -65,11 +63,3 @@ typedef enum {
SORT_METHOD_DATE_TAKEN,
SORT_METHOD_MAX
} SORT_METHOD;
-
-typedef struct
-{
- SORT_METHOD m_sortMethod;
- int m_buttonLabel;
- LABEL_MASKS m_labelMasks;
-} SORT_METHOD_DETAILS;
-
View
6 xbmc/addons/AddonInstaller.cpp
@@ -413,11 +413,11 @@ void CAddonInstaller::PrunePackageCache()
for (std::map<CStdString,CFileItemList*>::const_iterator it = packs.begin();
it != packs.end();++it)
{
- it->second->Sort(SORT_METHOD_LABEL,SortOrderDescending);
+ it->second->Sort(SortByLabel, SortOrderDescending);
for (int j=2;j<it->second->Size();++j)
items.Add(CFileItemPtr(new CFileItem(*it->second->Get(j))));
}
- items.Sort(SORT_METHOD_SIZE,SortOrderDescending);
+ items.Sort(SortBySize, SortOrderDescending);
int i=0;
while (size > limit && i < items.Size())
{
@@ -435,7 +435,7 @@ void CAddonInstaller::PrunePackageCache()
if (it->second->Size() > 1)
items.Add(CFileItemPtr(new CFileItem(*it->second->Get(1))));
}
- items.Sort(SORT_METHOD_DATE,SortOrderAscending);
+ items.Sort(SortByDate, SortOrderAscending);
i=0;
while (size > limit && i < items.Size())
{
View
2  xbmc/addons/GUIDialogAddonInfo.cpp
@@ -396,7 +396,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, SortOrderAscending);
+ items.Sort(SortByLabel, SortOrderAscending);
for (int i=0;i<items.Size();++i)
{
if (items[i]->m_bIsFolder)
View
6 xbmc/addons/GUIViewStateAddonBrowser.cpp
@@ -32,9 +32,9 @@ using namespace ADDON;
CGUIViewStateAddonBrowser::CGUIViewStateAddonBrowser(const CFileItemList& items) : CGUIViewState(items)
{
- AddSortMethod(SORT_METHOD_LABEL_IGNORE_FOLDERS, 551, LABEL_MASKS("%L", "%I", "%L", "")); // Filename, Size | Foldername, empty
- AddSortMethod(SORT_METHOD_DATE, 552, LABEL_MASKS("%L", "%J", "%L", "%J")); // Filename, Date | Foldername, Date
- SetSortMethod(SORT_METHOD_LABEL_IGNORE_FOLDERS);
+ AddSortMethod(SortByLabel, SortAttributeIgnoreFolders, 551, LABEL_MASKS("%L", "%I", "%L", "")); // Filename, Size | Foldername, empty
+ AddSortMethod(SortByDate, 552, LABEL_MASKS("%L", "%J", "%L", "%J")); // Filename, Date | Foldername, Date
+ SetSortMethod(SortByLabel, SortAttributeIgnoreFolders);
SetViewAsControl(DEFAULT_VIEW_AUTO);
View
2  xbmc/addons/GUIWindowAddonBrowser.cpp
@@ -448,7 +448,7 @@ int CGUIWindowAddonBrowser::SelectAddonID(const vector<ADDON::TYPE> &types, CStd
item->SetSpecialSort(SortSpecialOnTop);
items.Add(item);
}
- items.Sort(SORT_METHOD_LABEL, SortOrderAscending);
+ items.Sort(SortByLabel, SortOrderAscending);
if (addonIDs.size() > 0)
{
View
2  xbmc/dialogs/GUIDialogFileBrowser.cpp
@@ -334,7 +334,7 @@ void CGUIDialogFileBrowser::ClearFileItems()
void CGUIDialogFileBrowser::OnSort()
{
if (!m_singleList)
- m_vecItems->Sort(SORT_METHOD_LABEL, SortOrderAscending);
+ m_vecItems->Sort(SortByLabel, SortOrderAscending);
}
void CGUIDialogFileBrowser::Update(const CStdString &strDirectory)
View
2  xbmc/dialogs/GUIDialogMediaFilter.cpp
@@ -752,7 +752,7 @@ void CGUIDialogMediaFilter::OnBrowse(const Filter &filter, CFileItemList &items,
}
// sort the items
- selectItems.Sort(SORT_METHOD_LABEL, SortOrderAscending);
+ selectItems.Sort(SortByLabel, SortOrderAscending);
CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
pDialog->Reset();
View
2  xbmc/dialogs/GUIDialogSelect.cpp
@@ -228,7 +228,7 @@ bool CGUIDialogSelect::IsButtonPressed()
void CGUIDialogSelect::Sort(bool bSortOrder /*=true*/)
{
- m_vecList->Sort(SORT_METHOD_LABEL, bSortOrder ? SortOrderAscending : SortOrderDescending);
+ m_vecList->Sort(SortByLabel, bSortOrder ? SortOrderAscending : SortOrderDescending);
}
void CGUIDialogSelect::SetSelected(int iSelected)
View
2  xbmc/dialogs/GUIDialogSmartPlaylistRule.cpp
@@ -308,7 +308,7 @@ void CGUIDialogSmartPlaylistRule::OnBrowse()
}
// sort the items
- items.Sort(SORT_METHOD_LABEL, SortOrderAscending);
+ items.Sort(SortByLabel, SortOrderAscending);
CGUIDialogSelect* pDialog = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
pDialog->Reset();
View
4 xbmc/filesystem/BlurayDirectory.cpp
@@ -174,8 +174,8 @@ bool CBlurayDirectory::GetDirectory(const CStdString& path, CFileItemList &items
else
return false;
- items.AddSortMethod(SORT_METHOD_TRACKNUM , 554, LABEL_MASKS("%L", "%D", "%L", "")); // FileName, Duration | Foldername, empty
- items.AddSortMethod(SORT_METHOD_SIZE , 553, LABEL_MASKS("%L", "%I", "%L", "%I")); // FileName, Size | Foldername, Size
+ items.AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS("%L", "%D", "%L", "")); // FileName, Duration | Foldername, empty
+ items.AddSortMethod(SortBySize, 553, LABEL_MASKS("%L", "%I", "%L", "%I")); // FileName, Size | Foldername, Size
return true;
}
View
14 xbmc/filesystem/HTSPDirectory.cpp
@@ -389,17 +389,9 @@ bool CHTSPDirectory::GetChannels( const CURL &base
items.Add(item);
}
- items.AddSortMethod(SORT_METHOD_TRACKNUM, 554, LABEL_MASKS("%K[ - %B]", "%Z", "%L", ""));
-
- if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
- items.AddSortMethod(SORT_METHOD_ALBUM_IGNORE_THE, 558, LABEL_MASKS("%B", "%Z", "%L", ""));
- else
- items.AddSortMethod(SORT_METHOD_ALBUM, 558, LABEL_MASKS("%B", "%Z", "%L", ""));
-
- if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
- items.AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551, LABEL_MASKS("%Z", "%B", "%L", ""));
- else
- items.AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%Z", "%B", "%L", ""));
+ items.AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS("%K[ - %B]", "%Z", "%L", ""));
+ items.AddSortMethod(SortByAlbum, 558, LABEL_MASKS("%B", "%Z", "%L", ""), CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SortAttributeIgnoreArticle : SortAttributeNone);
+ items.AddSortMethod(SortByLabel, 551, LABEL_MASKS("%Z", "%B", "%L", ""), CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SortAttributeIgnoreArticle : SortAttributeNone);
items.SetContent("livetv");
View
2  xbmc/filesystem/LibraryDirectory.cpp
@@ -140,7 +140,7 @@ bool CLibraryDirectory::GetDirectory(const CStdString& strPath, CFileItemList &i
items.Add(item);
}
}
- items.Sort(SORT_METHOD_PLAYLIST_ORDER, SortOrderAscending);
+ items.Sort(SortByPlaylistOrder, SortOrderAscending);
return true;
}
View
2  xbmc/filesystem/MultiPathDirectory.cpp
@@ -260,7 +260,7 @@ void CMultiPathDirectory::MergeItems(CFileItemList &items)
return;
// sort items by label
// folders are before files in this sort method
- items.Sort(SORT_METHOD_LABEL, SortOrderAscending);
+ items.Sort(SortByLabel, SortOrderAscending);
int i = 0;
// if first item in the sorted list is a file, just abort
View
29 xbmc/filesystem/MythDirectory.cpp
@@ -150,7 +150,7 @@ bool CMythDirectory::GetGuide(const CStdString& base, CFileItemList &items)
}
}
- items.AddSortMethod(SORT_METHOD_LABEL, 551 /* Name */, LABEL_MASKS("", "", "%K", ""));
+ items.AddSortMethod(SortByLabel, 551 /* Name */, LABEL_MASKS("", "", "%K", ""));
m_dll->ref_release(list);
return true;
@@ -227,7 +227,7 @@ bool CMythDirectory::GetGuideForChannel(const CStdString& base, CFileItemList &i
* result in the guide being shown in the wrong order for skins that sort by date in descending
* order by default with no option to change to ascending, e.g. Confluence.
*/
- items.AddSortMethod(SORT_METHOD_NONE, 552 /* Date */, LABEL_MASKS("%K", "%J")); // Still leave the date label
+ items.AddSortMethod(SortByNone, 552 /* Date */, LABEL_MASKS("%K", "%J")); // Still leave the date label
m_dll->ref_release(program);
return true;
@@ -325,13 +325,8 @@ bool CMythDirectory::GetRecordings(const CStdString& base, CFileItemList &items,
* the subtitle doesn't influence the sort order and they are sorted by date.
*/
if (type != TV_SHOWS)
- {
- if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
- items.AddSortMethod(SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE, 556, LABEL_MASKS("%K", "%J"));
- else
- items.AddSortMethod(SORT_METHOD_VIDEO_SORT_TITLE, 556, LABEL_MASKS("%K", "%J"));
- }
- items.AddSortMethod(SORT_METHOD_DATE, 552 /* Date */, LABEL_MASKS("%K", "%J"));
+ items.AddSortMethod(SortBySortTitle, 556 /* Name */, LABEL_MASKS("%K", "%J"), CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SortAttributeIgnoreArticle : SortAttributeNone);
+ items.AddSortMethod(SortByDate, 552 /* Date */, LABEL_MASKS("%K", "%J"));
return true;
}
@@ -392,11 +387,8 @@ bool CMythDirectory::GetTvShowFolders(const CStdString& base, CFileItemList &ite
}
m_dll->ref_release(list);
- if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
- items.AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551 /* Name */, LABEL_MASKS("", "", "%L", "%J"));
- else
- items.AddSortMethod(SORT_METHOD_LABEL, 551 /* Name */, LABEL_MASKS("", "", "%L", "%J"));
- items.AddSortMethod(SORT_METHOD_DATE, 552 /* Date */, LABEL_MASKS("", "", "%L", "%J"));
+ items.AddSortMethod(SortByLabel, 551 /* Name */, LABEL_MASKS("", "", "%L", "%J"), CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SortAttributeIgnoreArticle : SortAttributeNone);
+ items.AddSortMethod(SortByDate, 552 /* Date */, LABEL_MASKS("", "", "%L", "%J"));
return true;
}
@@ -464,15 +456,12 @@ bool CMythDirectory::GetChannels(const CStdString& base, CFileItemList &items)
m_dll->ref_release(program);
}
- items.AddSortMethod(SORT_METHOD_LABEL, 551 /* Name */, LABEL_MASKS("%K", "%B"));
+ items.AddSortMethod(SortByLabel, 551 /* Name */, LABEL_MASKS("%K", "%B"));
/*
* Video sort title is set to the channel number.
*/
- if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
- items.AddSortMethod(SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE, 556 /* Title */, LABEL_MASKS("%K", "%B"));
- else
- items.AddSortMethod(SORT_METHOD_VIDEO_SORT_TITLE, 556 /* Title */, LABEL_MASKS("%K", "%B"));
+ items.AddSortMethod(SortBySortTitle, 556 /* Title */, LABEL_MASKS("%K", "%B"), CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SortAttributeIgnoreArticle : SortAttributeNone);
return true;
}
@@ -528,7 +517,7 @@ bool CMythDirectory::GetDirectory(const CStdString& strPath, CFileItemList &item
item->SetLabel(g_localizeStrings.Get(22020)); // Guide
items.Add(item);
- items.AddSortMethod(SORT_METHOD_NONE, 564 /* Type */, LABEL_MASKS("", "", "%L", "")); // No sorting, as added to list.
+ items.AddSortMethod(SortByNone, 564 /* Type */, LABEL_MASKS("", "", "%L", "")); // No sorting, as added to list.
/*
* Clear the directory cache so the cached sub-folders are guaranteed to be accurate.
View
2  xbmc/filesystem/PVRDirectory.cpp
@@ -92,7 +92,7 @@ bool CPVRDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items
items.Add(item);
// Sort by name only. Labels are preformated.
- items.AddSortMethod(SORT_METHOD_LABEL, 551 /* Name */, LABEL_MASKS("%L", "", "%L", ""));
+ items.AddSortMethod(SortByLabel, 551 /* Name */, LABEL_MASKS("%L", "", "%L", ""));
return true;
}
View
96 xbmc/filesystem/PluginDirectory.cpp
@@ -209,7 +209,7 @@ void CPluginDirectory::EndOfDirectory(int handle, bool success, bool replaceList
dir->m_listItems->SetReplaceListing(replaceListing);
if (!dir->m_listItems->HasSortDetails())
- dir->m_listItems->AddSortMethod(SORT_METHOD_NONE, 552, LABEL_MASKS("%L", "%D"));
+ dir->m_listItems->AddSortMethod(SortByNone, 552, LABEL_MASKS("%L", "%D"));
// set the event to mark that we're done
dir->m_fetchComplete.Set();
@@ -228,145 +228,119 @@ void CPluginDirectory::AddSortMethod(int handle, SORT_METHOD sortMethod, const C
case SORT_METHOD_LABEL:
case SORT_METHOD_LABEL_IGNORE_THE:
{
- if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
- dir->m_listItems->AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551, LABEL_MASKS("%T", label2Mask));
- else
- dir->m_listItems->AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%T", label2Mask));
+ dir->m_listItems->AddSortMethod(SortByLabel, 551, LABEL_MASKS("%T", label2Mask), CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SortAttributeIgnoreArticle : SortAttributeNone);
break;
}
case SORT_METHOD_TITLE:
case SORT_METHOD_TITLE_IGNORE_THE:
{
- if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
- dir->m_listItems->AddSortMethod(SORT_METHOD_TITLE_IGNORE_THE, 556, LABEL_MASKS("%T", label2Mask));
- else
- dir->m_listItems->AddSortMethod(SORT_METHOD_TITLE, 556, LABEL_MASKS("%T", label2Mask));
+ dir->m_listItems->AddSortMethod(SortByTitle, 556, LABEL_MASKS("%T", label2Mask), CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SortAttributeIgnoreArticle : SortAttributeNone);
break;
}
case SORT_METHOD_ARTIST:
case SORT_METHOD_ARTIST_IGNORE_THE:
{
- if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
- dir->m_listItems->AddSortMethod(SORT_METHOD_ARTIST_IGNORE_THE, 557, LABEL_MASKS("%T", "%A"));
- else
- dir->m_listItems->AddSortMethod(SORT_METHOD_ARTIST, 557, LABEL_MASKS("%T", "%A"));
+ dir->m_listItems->AddSortMethod(SortByArtist, 557, LABEL_MASKS("%T", "%A"), CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SortAttributeIgnoreArticle : SortAttributeNone);
break;
}
case SORT_METHOD_ALBUM:
case SORT_METHOD_ALBUM_IGNORE_THE:
{
- if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
- dir->m_listItems->AddSortMethod(SORT_METHOD_ALBUM_IGNORE_THE, 558, LABEL_MASKS("%T", "%B"));
- else
- dir->m_listItems->AddSortMethod(SORT_METHOD_ALBUM, 558, LABEL_MASKS("%T", "%B"));
+ dir->m_listItems->AddSortMethod(SortByAlbum, 558, LABEL_MASKS("%T", "%B"), CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SortAttributeIgnoreArticle : SortAttributeNone);
break;
}
case SORT_METHOD_DATE:
{
- dir->m_listItems->AddSortMethod(SORT_METHOD_DATE, 552, LABEL_MASKS("%T", "%J"));
+ dir->m_listItems->AddSortMethod(SortByDate, 552, LABEL_MASKS("%T", "%J"));
break;
}
case SORT_METHOD_BITRATE:
{
- dir->m_listItems->AddSortMethod(SORT_METHOD_BITRATE, 623, LABEL_MASKS("%T", "%X"));
+ dir->m_listItems->AddSortMethod(SortByBitrate, 623, LABEL_MASKS("%T", "%X"));
break;
}
case SORT_METHOD_SIZE:
{
- dir->m_listItems->AddSortMethod(SORT_METHOD_SIZE, 553, LABEL_MASKS("%T", "%I"));
+ dir->m_listItems->AddSortMethod(SortBySize, 553, LABEL_MASKS("%T", "%I"));
break;
}
case SORT_METHOD_FILE:
{
- dir->m_listItems->AddSortMethod(SORT_METHOD_FILE, 561, LABEL_MASKS("%T", label2Mask));
+ dir->m_listItems->AddSortMethod(SortByFile, 561, LABEL_MASKS("%T", label2Mask));
break;
}
case SORT_METHOD_TRACKNUM:
{
- dir->m_listItems->AddSortMethod(SORT_METHOD_TRACKNUM, 554, LABEL_MASKS("[%N. ]%T", label2Mask));
+ dir->m_listItems->AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS("[%N. ]%T", label2Mask));
break;
}
case SORT_METHOD_DURATION:
+ case SORT_METHOD_VIDEO_RUNTIME:
{
- dir->m_listItems->AddSortMethod(SORT_METHOD_DURATION, 180, LABEL_MASKS("%T", "%D"));
+ dir->m_listItems->AddSortMethod(SortByTime, 180, LABEL_MASKS("%T", "%D"));
break;
}
case SORT_METHOD_VIDEO_RATING:
+ case SORT_METHOD_SONG_RATING:
{
- dir->m_listItems->AddSortMethod(SORT_METHOD_VIDEO_RATING, 563, LABEL_MASKS("%T", "%R"));
+ dir->m_listItems->AddSortMethod(SortByRating, 563, LABEL_MASKS("%T", "%R"));
break;
}
case SORT_METHOD_YEAR:
{
- dir->m_listItems->AddSortMethod(SORT_METHOD_YEAR, 562, LABEL_MASKS("%T", "%Y"));
- break;
- }
- case SORT_METHOD_SONG_RATING:
- {
- dir->m_listItems->AddSortMethod(SORT_METHOD_SONG_RATING, 563, LABEL_MASKS("%T", "%R"));
+ dir->m_listItems->AddSortMethod(SortByYear, 562, LABEL_MASKS("%T", "%Y"));
break;
}
case SORT_METHOD_GENRE:
{
- dir->m_listItems->AddSortMethod(SORT_METHOD_GENRE, 515, LABEL_MASKS("%T", "%G"));
+ dir->m_listItems->AddSortMethod(SortByGenre, 515, LABEL_MASKS("%T", "%G"));
break;
}
case SORT_METHOD_COUNTRY:
{
- dir->m_listItems->AddSortMethod(SORT_METHOD_COUNTRY, 574, LABEL_MASKS("%T", "%G"));
+ dir->m_listItems->AddSortMethod(SortByCountry, 574, LABEL_MASKS("%T", "%G"));
break;
}
case SORT_METHOD_VIDEO_TITLE:
{
- dir->m_listItems->AddSortMethod(SORT_METHOD_VIDEO_TITLE, 369, LABEL_MASKS("%T", label2Mask));
+ dir->m_listItems->AddSortMethod(SortByTitle, 369, LABEL_MASKS("%T", label2Mask));
break;
}
case SORT_METHOD_VIDEO_SORT_TITLE:
case SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE:
{
- if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
- dir->m_listItems->AddSortMethod(SORT_METHOD_VIDEO_SORT_TITLE_IGNORE_THE, 556, LABEL_MASKS("%T", label2Mask));
- else
- dir->m_listItems->AddSortMethod(SORT_METHOD_VIDEO_SORT_TITLE, 556, LABEL_MASKS("%T", label2Mask));
+ dir->m_listItems->AddSortMethod(SortBySortTitle, 556, LABEL_MASKS("%T", label2Mask), CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SortAttributeIgnoreArticle : SortAttributeNone);
break;
}
case SORT_METHOD_MPAA_RATING:
{
- dir->m_listItems->AddSortMethod(SORT_METHOD_MPAA_RATING, 20074, LABEL_MASKS("%T", "%O"));
- break;
- }
- case SORT_METHOD_VIDEO_RUNTIME:
- {
- dir->m_listItems->AddSortMethod(SORT_METHOD_VIDEO_RUNTIME, 180, LABEL_MASKS("%T", "%D"));
+ dir->m_listItems->AddSortMethod(SortByMPAA, 20074, LABEL_MASKS("%T", "%O"));
break;
}
case SORT_METHOD_STUDIO:
case SORT_METHOD_STUDIO_IGNORE_THE:
{
- if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
- dir->m_listItems->AddSortMethod(SORT_METHOD_STUDIO_IGNORE_THE, 572, LABEL_MASKS("%T", "%U"));
- else
- dir->m_listItems->AddSortMethod(SORT_METHOD_STUDIO, 572, LABEL_MASKS("%T", "%U"));
+ dir->m_listItems->AddSortMethod(SortByStudio, 572, LABEL_MASKS("%T", "%U"), CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SortAttributeIgnoreArticle : SortAttributeNone);
break;
}
case SORT_METHOD_PROGRAM_COUNT:
{
- dir->m_listItems->AddSortMethod(SORT_METHOD_PROGRAM_COUNT, 567, LABEL_MASKS("%T", "%C"));
+ dir->m_listItems->AddSortMethod(SortByProgramCount, 567, LABEL_MASKS("%T", "%C"));
break;
}
case SORT_METHOD_UNSORTED:
{
- dir->m_listItems->AddSortMethod(SORT_METHOD_UNSORTED, 571, LABEL_MASKS("%T", label2Mask));
+ dir->m_listItems->AddSortMethod(SortByNone, 571, LABEL_MASKS("%T", label2Mask));
break;
}
case SORT_METHOD_NONE:
{
- dir->m_listItems->AddSortMethod(SORT_METHOD_NONE, 552, LABEL_MASKS("%T", label2Mask));
+ dir->m_listItems->AddSortMethod(SortByNone, 552, LABEL_MASKS("%T", label2Mask));
break;
}
case SORT_METHOD_DRIVE_TYPE:
{
- dir->m_listItems->AddSortMethod(SORT_METHOD_DRIVE_TYPE, 564, LABEL_MASKS()); // Preformatted
+ dir->m_listItems->AddSortMethod(SortByDriveType, 564, LABEL_MASKS()); // Preformatted
break;
}
case SORT_METHOD_PLAYLIST_ORDER:
@@ -374,53 +348,53 @@ void CPluginDirectory::AddSortMethod(int handle, SORT_METHOD sortMethod, const C
CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat");
CStdString strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright");
- dir->m_listItems->AddSortMethod(SORT_METHOD_PLAYLIST_ORDER, 559, LABEL_MASKS(strTrackLeft, strTrackRight));
+ dir->m_listItems->AddSortMethod(SortByPlaylistOrder, 559, LABEL_MASKS(strTrackLeft, strTrackRight));
break;
}
case SORT_METHOD_EPISODE:
{
- dir->m_listItems->AddSortMethod(SORT_METHOD_EPISODE,20359,LABEL_MASKS("%E. %T","%R"));
+ dir->m_listItems->AddSortMethod(SortByEpisodeNumber, 20359, LABEL_MASKS("%E. %T","%R"));
break;
}
case SORT_METHOD_PRODUCTIONCODE:
{
//dir->m_listItems.AddSortMethod(SORT_METHOD_PRODUCTIONCODE,20368,LABEL_MASKS("%E. %T","%P", "%E. %T","%P"));
- dir->m_listItems->AddSortMethod(SORT_METHOD_PRODUCTIONCODE,20368,LABEL_MASKS("%H. %T","%P", "%H. %T","%P"));
+ dir->m_listItems->AddSortMethod(SortByProductionCode, 20368, LABEL_MASKS("%H. %T","%P", "%H. %T","%P"));
break;
}
case SORT_METHOD_LISTENERS:
{
- dir->m_listItems->AddSortMethod(SORT_METHOD_LISTENERS,20455,LABEL_MASKS("%T","%W"));
+ dir->m_listItems->AddSortMethod(SortByListeners, 20455, LABEL_MASKS("%T","%W"));
break;
}
case SORT_METHOD_DATEADDED:
{
- dir->m_listItems->AddSortMethod(SORT_METHOD_DATEADDED, 570, LABEL_MASKS("%T", "%a"));
+ dir->m_listItems->AddSortMethod(SortByDateAdded, 570, LABEL_MASKS("%T", "%a"));
break;
}
case SORT_METHOD_FULLPATH:
{
- dir->m_listItems->AddSortMethod(SORT_METHOD_FULLPATH, 573, LABEL_MASKS("%T", label2Mask));
+ dir->m_listItems->AddSortMethod(SortByPath, 573, LABEL_MASKS("%T", label2Mask));
break;
}
case SORT_METHOD_LABEL_IGNORE_FOLDERS:
{
- dir->m_listItems->AddSortMethod(SORT_METHOD_LABEL_IGNORE_FOLDERS, 551, LABEL_MASKS("%T", label2Mask));
+ dir->m_listItems->AddSortMethod(SortByLabel, SortAttributeIgnoreFolders, 551, LABEL_MASKS("%T", label2Mask));
break;
}
case SORT_METHOD_LASTPLAYED:
{
- dir->m_listItems->AddSortMethod(SORT_METHOD_LASTPLAYED, 568, LABEL_MASKS("%T", "%G"));
+ dir->m_listItems->AddSortMethod(SortByLastPlayed, 568, LABEL_MASKS("%T", "%G"));
break;
}
case SORT_METHOD_PLAYCOUNT:
{
- dir->m_listItems->AddSortMethod(SORT_METHOD_PLAYCOUNT, 567, LABEL_MASKS("%T", "%V"));
+ dir->m_listItems->AddSortMethod(SortByPlaycount, 567, LABEL_MASKS("%T", "%V"));
break;
}
case SORT_METHOD_CHANNEL:
{
- dir->m_listItems->AddSortMethod(SORT_METHOD_CHANNEL, 19029, LABEL_MASKS("%T", label2Mask));
+ dir->m_listItems->AddSortMethod(SortByChannel, 19029, LABEL_MASKS("%T", label2Mask));
break;
}
View
1  xbmc/filesystem/PluginDirectory.h
@@ -33,6 +33,7 @@
#include "threads/Event.h"
class CURL;
+class CFileItem;
class CFileItemList;
namespace XFILE
View
8 xbmc/filesystem/RSSDirectory.cpp
@@ -613,10 +613,10 @@ bool CRSSDirectory::GetDirectory(const CStdString& path, CFileItemList &items)
items.Add(item);
}
- items.AddSortMethod(SORT_METHOD_UNSORTED , 231, LABEL_MASKS("%L", "%D", "%L", "")); // FileName, Duration | Foldername, empty
- items.AddSortMethod(SORT_METHOD_LABEL , 551, LABEL_MASKS("%L", "%D", "%L", "")); // FileName, Duration | Foldername, empty
- items.AddSortMethod(SORT_METHOD_SIZE , 553, LABEL_MASKS("%L", "%I", "%L", "%I")); // FileName, Size | Foldername, Size
- items.AddSortMethod(SORT_METHOD_DATE , 552, LABEL_MASKS("%L", "%J", "%L", "%J")); // FileName, Date | Foldername, Date
+ items.AddSortMethod(SortByNone , 231, LABEL_MASKS("%L", "%D", "%L", "")); // FileName, Duration | Foldername, empty
+ items.AddSortMethod(SortByLabel , 551, LABEL_MASKS("%L", "%D", "%L", "")); // FileName, Duration | Foldername, empty
+ items.AddSortMethod(SortBySize , 553, LABEL_MASKS("%L", "%I", "%L", "%I")); // FileName, Size | Foldername, Size
+ items.AddSortMethod(SortByDate , 552, LABEL_MASKS("%L", "%J", "%L", "%J")); // FileName, Date | Foldername, Date
CDateTime time = CDateTime::GetCurrentDateTime();
int mins = 60;
View
2  xbmc/filesystem/RarManager.cpp
@@ -117,7 +117,7 @@ bool CRarManager::CacheRarredFile(CStdString& strPathInCache, const CStdString&
{
CFileItemList items;
CDirectory::GetDirectory(g_advancedSettings.m_cachePath,items);
- items.Sort(SORT_METHOD_SIZE, SortOrderDescending);
+ items.Sort(SortBySize, SortOrderDescending);
while (items.Size() && CheckFreeSpace(strDir) < iSize)
{
if (!items[0]->m_bIsFolder)
View
2  xbmc/filesystem/SmartPlaylistDirectory.cpp
@@ -287,7 +287,7 @@ namespace XFILE
// sort grouped list by label
if (items.Size() > 1 && !group.empty())
- items.Sort(SORT_METHOD_LABEL_IGNORE_THE, SortOrderAscending);
+ items.Sort(SortByLabel, SortOrderAscending, SortAttributeIgnoreArticle);
// go through and set the playlist order
for (int i = 0; i < items.Size(); i++)
View
8 xbmc/filesystem/UPnPDirectory.cpp
@@ -355,10 +355,10 @@ CUPnPDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items)
items.SetContent(content);
if (content == "unknown")
{
- items.AddSortMethod(SORT_METHOD_UNSORTED, 571, LABEL_MASKS("%L", "%I", "%L", ""));
- items.AddSortMethod(SORT_METHOD_LABEL_IGNORE_FOLDERS, 551, LABEL_MASKS("%L", "%I", "%L", ""));
- items.AddSortMethod(SORT_METHOD_SIZE, 553, LABEL_MASKS("%L", "%I", "%L", "%I"));
- items.AddSortMethod(SORT_METHOD_DATE, 552, LABEL_MASKS("%L", "%J", "%L", "%J"));
+ items.AddSortMethod(SortByNone, 571, LABEL_MASKS("%L", "%I", "%L", ""));
+ items.AddSortMethod(SortByLabel, SortAttributeIgnoreFolders, 551, LABEL_MASKS("%L", "%I", "%L", ""));
+ items.AddSortMethod(SortBySize, 553, LABEL_MASKS("%L", "%I", "%L", "%I"));
+ items.AddSortMethod(SortByDate, 552, LABEL_MASKS("%L", "%J", "%L", "%J"));
}
}
View
12 xbmc/filesystem/test/TestRarFile.cpp
@@ -202,7 +202,7 @@ TEST(TestRarFile, StoredRAR)
reffile = XBMC_REF_FILE_PATH("xbmc/filesystem/test/refRARstored.rar");
URIUtils::CreateArchivePath(strrarpath, "rar", reffile, "");
ASSERT_TRUE(XFILE::CDirectory::GetDirectory(strrarpath, itemlist));
- itemlist.Sort(SORT_METHOD_FULLPATH, SortOrderAscending);
+ itemlist.Sort(SortByPath, SortOrderAscending);
/* /reffile.txt */
/*
@@ -286,7 +286,7 @@ TEST(TestRarFile, StoredRAR)
itemlist.Clear();
ASSERT_TRUE(XFILE::CDirectory::GetDirectory(strpathinrar, itemlist));
- itemlist.Sort(SORT_METHOD_FULLPATH, SortOrderAscending);
+ itemlist.Sort(SortByPath, SortOrderAscending);
/* /testdir/reffile.txt */
strpathinrar = itemlist[1]->GetPath();
@@ -367,7 +367,7 @@ TEST(TestRarFile, StoredRAR)
itemlist.Clear();
ASSERT_TRUE(XFILE::CDirectory::GetDirectory(strpathinrar, itemlist));
- itemlist.Sort(SORT_METHOD_FULLPATH, SortOrderAscending);
+ itemlist.Sort(SortByPath, SortOrderAscending);
/* /testdir/testsubdir/reffile.txt */
strpathinrar = itemlist[0]->GetPath();
@@ -428,7 +428,7 @@ TEST(TestRarFile, NormalRAR)
reffile = XBMC_REF_FILE_PATH("xbmc/filesystem/test/refRARnormal.rar");
URIUtils::CreateArchivePath(strrarpath, "rar", reffile, "");
ASSERT_TRUE(XFILE::CDirectory::GetDirectory(strrarpath, itemlist));
- itemlist.Sort(SORT_METHOD_FULLPATH, SortOrderAscending);
+ itemlist.Sort(SortByPath, SortOrderAscending);
/* /reffile.txt */
strpathinrar = itemlist[1]->GetPath();
@@ -508,7 +508,7 @@ TEST(TestRarFile, NormalRAR)
itemlist.Clear();
ASSERT_TRUE(XFILE::CDirectory::GetDirectory(strpathinrar, itemlist));
- itemlist.Sort(SORT_METHOD_FULLPATH, SortOrderAscending);
+ itemlist.Sort(SortByPath, SortOrderAscending);
/* /testdir/reffile.txt */
strpathinrar = itemlist[1]->GetPath();
@@ -589,7 +589,7 @@ TEST(TestRarFile, NormalRAR)
itemlist.Clear();
ASSERT_TRUE(XFILE::CDirectory::GetDirectory(strpathinrar, itemlist));
- itemlist.Sort(SORT_METHOD_FULLPATH, SortOrderAscending);
+ itemlist.Sort(SortByPath, SortOrderAscending);
/* /testdir/testsubdir/reffile.txt */
strpathinrar = itemlist[0]->GetPath();
View
4 xbmc/input/ButtonTranslator.cpp
@@ -529,7 +529,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, SortOrderAscending);
+ files.Sort(SortByFile, SortOrderAscending);
for(int fileIndex = 0; fileIndex<files.Size(); ++fileIndex)
{
if (!files[fileIndex]->m_bIsFolder)
@@ -548,7 +548,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, SortOrderAscending);
+ files.Sort(SortByFile, SortOrderAscending);
for(int fileIndex = 0; fileIndex<files.Size(); ++fileIndex)
{
if (!files[fileIndex]->m_bIsFolder)
View
6 xbmc/interfaces/json-rpc/AudioLibrary.cpp
@@ -638,14 +638,14 @@ bool CAudioLibrary::FillFileItemList(const CVariant &parameterObject, 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, SortOrderAscending);
+ list.Sort(SortByAlbum, SortOrderAscending, SortAttributeIgnoreArticle);
// 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, SortOrderAscending);
+ list.Sort(SortByArtist, SortOrderAscending, SortAttributeIgnoreArticle);
// otherwise we sort by track number
else
- list.Sort(SORT_METHOD_TRACKNUM, SortOrderAscending);
+ list.Sort(SortByTrackNumber, SortOrderAscending);
}
View
2  xbmc/interfaces/json-rpc/FileOperations.cpp
@@ -314,7 +314,7 @@ bool CFileOperations::FillFileItemList(const CVariant &parameterObject, CFileIte
CDirectory directory;
if (directory.GetDirectory(strPath, items, extensions))
{
- items.Sort(SORT_METHOD_FILE, SortOrderAscending);
+ items.Sort(SortByFile, SortOrderAscending);
CFileItemList filteredDirectories;
for (unsigned int i = 0; i < (unsigned int)items.Size(); i++)
{
View
304 xbmc/music/GUIViewStateMusic.cpp
@@ -82,20 +82,16 @@ CGUIViewStateMusicSearch::CGUIViewStateMusicSearch(const CFileItemList& items) :
if (strAlbumRight.IsEmpty())
strAlbumRight = "%A"; // artist
+ SortAttribute sortAttribute = SortAttributeNone;
if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
- {
- AddSortMethod(SORT_METHOD_TITLE_IGNORE_THE, 556, LABEL_MASKS("%T - %A", "%D", "%L", "%A")); // Title, Artist, Duration| empty, empty
- SetSortMethod(SORT_METHOD_TITLE_IGNORE_THE);
- }
- else
- {
- AddSortMethod(SORT_METHOD_TITLE, 556, LABEL_MASKS("%T - %A", "%D", "%L", "%A")); // Title, Artist, Duration| empty, empty
- SetSortMethod(SORT_METHOD_TITLE);
- }
+ sortAttribute = SortAttributeIgnoreArticle;
+
+ AddSortMethod(SortByTitle, sortAttribute, 556, LABEL_MASKS("%T - %A", "%D", "%L", "%A")); // Title, Artist, Duration| empty, empty
+ SetSortMethod(SortByTitle, sortAttribute);
const CViewState *viewState = CViewStateSettings::Get().Get("musicnavsongs");
SetViewAsControl(viewState->m_viewMode);
- SetSortOrder(viewState->m_sortOrder);
+ SetSortOrder(viewState->m_sortDescription.sortOrder);
LoadViewState(items.GetPath(), WINDOW_MUSIC_NAV);
}
@@ -127,12 +123,16 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item
CLog::Log(LOGDEBUG,"Album format left = [%s]", strAlbumLeft.c_str());
CLog::Log(LOGDEBUG,"Album format right = [%s]", strAlbumRight.c_str());
+ SortAttribute sortAttribute = SortAttributeNone;
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
+ sortAttribute = SortAttributeIgnoreArticle;
+
switch (NodeType)
{
case NODE_TYPE_OVERVIEW:
{
- AddSortMethod(SORT_METHOD_NONE, 551, LABEL_MASKS("%F", "", "%L", "")); // Filename, empty | Foldername, empty
- SetSortMethod(SORT_METHOD_NONE);
+ AddSortMethod(SortByNone, 551, LABEL_MASKS("%F", "", "%L", "")); // Filename, empty | Foldername, empty
+ SetSortMethod(SortByNone);
SetViewAsControl(DEFAULT_VIEW_LIST);
@@ -141,8 +141,8 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item
break;
case NODE_TYPE_TOP100:
{
- AddSortMethod(SORT_METHOD_NONE, 551, LABEL_MASKS("%F", "", "%L", "")); // Filename, empty | Foldername, empty
- SetSortMethod(SORT_METHOD_NONE);
+ AddSortMethod(SortByNone, 551, LABEL_MASKS("%F", "", "%L", "")); // Filename, empty | Foldername, empty
+ SetSortMethod(SortByNone);
SetViewAsControl(DEFAULT_VIEW_LIST);
@@ -151,8 +151,8 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item
break;
case NODE_TYPE_GENRE:
{
- AddSortMethod(SORT_METHOD_GENRE, 515, LABEL_MASKS("%F", "", "%G", "")); // Filename, empty | Genre, empty
- SetSortMethod(SORT_METHOD_GENRE);
+ AddSortMethod(SortByGenre, 515, LABEL_MASKS("%F", "", "%G", "")); // Filename, empty | Genre, empty
+ SetSortMethod(SortByGenre);
SetViewAsControl(DEFAULT_VIEW_LIST);
@@ -161,8 +161,8 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item
break;
case NODE_TYPE_YEAR:
{
- AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%F", "", "%Y", "")); // Filename, empty | Year, empty
- SetSortMethod(SORT_METHOD_LABEL);
+ AddSortMethod(SortByLabel, 551, LABEL_MASKS("%F", "", "%Y", "")); // Filename, empty | Year, empty
+ SetSortMethod(SortByLabel);
SetViewAsControl(DEFAULT_VIEW_LIST);
@@ -171,20 +171,12 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item
break;
case NODE_TYPE_ARTIST:
{
- if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
- {
- AddSortMethod(SORT_METHOD_ARTIST_IGNORE_THE, 557, LABEL_MASKS("%F", "", "%A", "")); // Filename, empty | Artist, empty
- SetSortMethod(SORT_METHOD_ARTIST_IGNORE_THE);
- }
- else
- {
- AddSortMethod(SORT_METHOD_ARTIST, 557, LABEL_MASKS("%F", "", "%A", "")); // Filename, empty | Artist, empty
- SetSortMethod(SORT_METHOD_ARTIST);
- }
+ AddSortMethod(SortByArtist, sortAttribute, 557, LABEL_MASKS("%F", "", "%A", "")); // Filename, empty | Artist, empty
+ SetSortMethod(SortByArtist, sortAttribute);
const CViewState *viewState = CViewStateSettings::Get().Get("musicnavartists");
SetViewAsControl(viewState->m_viewMode);
- SetSortOrder(viewState->m_sortOrder);
+ SetSortOrder(viewState->m_sortDescription.sortOrder);
}
break;
case NODE_TYPE_ALBUM_COMPILATIONS:
@@ -192,30 +184,22 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item
case NODE_TYPE_YEAR_ALBUM:
{
// album
- if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
- AddSortMethod(SORT_METHOD_ALBUM_IGNORE_THE, 558, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
- else
- AddSortMethod(SORT_METHOD_ALBUM, 558, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
-
+ AddSortMethod(SortByAlbum, sortAttribute, 558, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
// artist
- if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
- AddSortMethod(SORT_METHOD_ARTIST_IGNORE_THE, 557, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
- else
- AddSortMethod(SORT_METHOD_ARTIST, 557, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
-
+ AddSortMethod(SortByArtist, sortAttribute, 557, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
// year
- AddSortMethod(SORT_METHOD_YEAR, 562, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight));
+ AddSortMethod(SortByYear, 562, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight));
const CViewState *viewState = CViewStateSettings::Get().Get("musicnavalbums");
- SetSortMethod(viewState->m_sortMethod);
+ SetSortMethod(viewState->m_sortDescription);
SetViewAsControl(viewState->m_viewMode);
- SetSortOrder(viewState->m_sortOrder);
+ SetSortOrder(viewState->m_sortDescription.sortOrder);
}
break;
case NODE_TYPE_ALBUM_RECENTLY_ADDED:
{
- AddSortMethod(SORT_METHOD_NONE, 552, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
- SetSortMethod(SORT_METHOD_NONE);
+ AddSortMethod(SortByNone, 552, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
+ SetSortMethod(SortByNone);
SetViewAsControl(CViewStateSettings::Get().Get("musicnavalbums")->m_viewMode);
@@ -224,8 +208,8 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item
break;
case NODE_TYPE_ALBUM_RECENTLY_ADDED_SONGS:
{
- AddSortMethod(SORT_METHOD_NONE, 552, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined | empty, empty
- SetSortMethod(SORT_METHOD_NONE);
+ AddSortMethod(SortByNone, 552, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined | empty, empty
+ SetSortMethod(SortByNone);
SetViewAsControl(CViewStateSettings::Get().Get("musicnavsongs")->m_viewMode);
@@ -234,8 +218,8 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item
break;
case NODE_TYPE_ALBUM_RECENTLY_PLAYED:
{
- AddSortMethod(SORT_METHOD_NONE, 551, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
- SetSortMethod(SORT_METHOD_NONE);
+ AddSortMethod(SortByNone, 551, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
+ SetSortMethod(SortByNone);
SetViewAsControl(CViewStateSettings::Get().Get("musicnavalbums")->m_viewMode);
@@ -244,8 +228,8 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item
break;
case NODE_TYPE_ALBUM_RECENTLY_PLAYED_SONGS:
{
- AddSortMethod(SORT_METHOD_NONE, 551, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined | empty, empty
- SetSortMethod(SORT_METHOD_NONE);
+ AddSortMethod(SortByNone, 551, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined | empty, empty
+ SetSortMethod(SortByNone);
SetViewAsControl(CViewStateSettings::Get().Get("musicnavalbums")->m_viewMode);
@@ -254,8 +238,8 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item
break;
case NODE_TYPE_ALBUM_TOP100:
{
- AddSortMethod(SORT_METHOD_NONE, 551, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
- SetSortMethod(SORT_METHOD_NONE);
+ AddSortMethod(SortByNone, 551, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
+ SetSortMethod(SortByNone);
SetViewAsControl(DEFAULT_VIEW_LIST);
SetSortOrder(SortOrderNone);
@@ -263,25 +247,16 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item
break;
case NODE_TYPE_SINGLES:
{
- if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
- {
- AddSortMethod(SORT_METHOD_ARTIST_IGNORE_THE, 557, LABEL_MASKS("%A - %T", "%D")); // Artist, Title, Duration| empty, empty
- AddSortMethod(SORT_METHOD_TITLE_IGNORE_THE, 556, LABEL_MASKS("%T - %A", "%D")); // Title, Artist, Duration| empty, empty
- AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551, LABEL_MASKS(strTrackLeft, strTrackRight));
- }
- else
- {
- AddSortMethod(SORT_METHOD_ARTIST, 557, LABEL_MASKS("%A - %T", "%D")); // Artist, Title, Duration| empty, empty
- AddSortMethod(SORT_METHOD_TITLE, 556, LABEL_MASKS("%T - %A", "%D")); // Title, Artist, Duration| empty, empty
- AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS(strTrackLeft, strTrackRight));
- }
- AddSortMethod(SORT_METHOD_DURATION, 180, LABEL_MASKS("%T - %A", "%D")); // Titel, Artist, Duration| empty, empty
- AddSortMethod(SORT_METHOD_SONG_RATING, 563, LABEL_MASKS("%T - %A", "%R")); // Title - Artist, Rating
+ AddSortMethod(SortByArtist, sortAttribute, 557, LABEL_MASKS("%A - %T", "%D")); // Artist, Title, Duration| empty, empty
+ AddSortMethod(SortByTitle, sortAttribute, 556, LABEL_MASKS("%T - %A", "%D")); // Title, Artist, Duration| empty, empty
+ AddSortMethod(SortByLabel, sortAttribute, 551, LABEL_MASKS(strTrackLeft, strTrackRight));
+ AddSortMethod(SortByTime, 180, LABEL_MASKS("%T - %A", "%D")); // Titel, Artist, Duration| empty, empty
+ AddSortMethod(SortByRating, 563, LABEL_MASKS("%T - %A", "%R")); // Title - Artist, Rating
const CViewState *viewState = CViewStateSettings::Get().Get("musicnavsongs");
- SetSortMethod(viewState->m_sortMethod);
+ SetSortMethod(viewState->m_sortDescription);
SetViewAsControl(viewState->m_viewMode);
- SetSortOrder(viewState->m_sortOrder);
+ SetSortOrder(viewState->m_sortDescription.sortOrder);
}
break;
case NODE_TYPE_ALBUM_COMPILATIONS_SONGS:
@@ -289,43 +264,33 @@ CGUIViewStateMusicDatabase::CGUIViewStateMusicDatabase(const CFileItemList& item
case NODE_TYPE_YEAR_SONG:
case NODE_TYPE_SONG:
{
- AddSortMethod(SORT_METHOD_TRACKNUM, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined| empty, empty
- if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
- {
- AddSortMethod(SORT_METHOD_TITLE_IGNORE_THE, 556, LABEL_MASKS("%T - %A", "%D")); // Title, Artist, Duration| empty, empty
- AddSortMethod(SORT_METHOD_ALBUM_IGNORE_THE, 558, LABEL_MASKS("%B - %T - %A", "%D")); // Album, Title, Artist, Duration| empty, empty
- AddSortMethod(SORT_METHOD_ARTIST_IGNORE_THE, 557, LABEL_MASKS("%A - %T", "%D")); // Artist, Title, Duration| empty, empty
- AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551, LABEL_MASKS(strTrackLeft, strTrackRight));
- }
- else
- {
- AddSortMethod(SORT_METHOD_TITLE, 556, LABEL_MASKS("%T - %A", "%D")); // Title, Artist, Duration| empty, empty
- AddSortMethod(SORT_METHOD_ALBUM, 558, LABEL_MASKS("%B - %T - %A", "%D")); // Album, Title, Artist, Duration| empty, empty
- AddSortMethod(SORT_METHOD_ARTIST, 557, LABEL_MASKS("%A - %T", "%D")); // Artist, Title, Duration| empty, empty
- AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS(strTrackLeft, strTrackRight));
- }
- AddSortMethod(SORT_METHOD_DURATION, 180, LABEL_MASKS("%T - %A", "%D")); // Titel, Artist, Duration| empty, empty
- AddSortMethod(SORT_METHOD_SONG_RATING, 563, LABEL_MASKS("%T - %A", "%R")); // Title - Artist, Rating
- AddSortMethod(SORT_METHOD_YEAR, 562, LABEL_MASKS("%T - %A", "%Y")); // Title, Artist, Year
+ AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined| empty, empty
+ AddSortMethod(SortByTitle, sortAttribute, 556, LABEL_MASKS("%T - %A", "%D")); // Title, Artist, Duration| empty, empty
+ AddSortMethod(SortByAlbum, sortAttribute, 558, LABEL_MASKS("%B - %T - %A", "%D")); // Album, Title, Artist, Duration| empty, empty
+ AddSortMethod(SortByArtist, sortAttribute, 557, LABEL_MASKS("%A - %T", "%D")); // Artist, Title, Duration| empty, empty
+ AddSortMethod(SortByLabel, sortAttribute, 551, LABEL_MASKS(strTrackLeft, strTrackRight));
+ AddSortMethod(SortByTime, 180, LABEL_MASKS("%T - %A", "%D")); // Titel, Artist, Duration| empty, empty
+ AddSortMethod(SortByRating, 563, LABEL_MASKS("%T - %A", "%R")); // Title - Artist, Rating
+ AddSortMethod(SortByYear, 562, LABEL_MASKS("%T - %A", "%Y")); // Title, Artist, Year
const CViewState *viewState = CViewStateSettings::Get().Get("musicnavsongs");
- // the "All Albums" entries always default to SORT_METHOD_ALBUM as this is most logical - user can always
+ // the "All Albums" entries always default to SortByAlbum as this is most logical - user can always
// change it and the change will be saved for this particular path
if (dir.IsAllItem(items.GetPath()))
- SetSortMethod(CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SORT_METHOD_ALBUM_IGNORE_THE : SORT_METHOD_ALBUM);
+ SetSortMethod(SortByAlbum, sortAttribute);
else
- SetSortMethod(viewState->m_sortMethod);
+ SetSortMethod(viewState->m_sortDescription);
- AddSortMethod(SORT_METHOD_PLAYCOUNT, 567, LABEL_MASKS("%T - %A", "%V")); // Titel - Artist, PlayCount
+ AddSortMethod(SortByPlaycount, 567, LABEL_MASKS("%T - %A", "%V")); // Titel - Artist, PlayCount
SetViewAsControl(viewState->m_viewMode);
- SetSortOrder(viewState->m_sortOrder);
+ SetSortOrder(viewState->m_sortDescription.sortOrder);
}
break;
case NODE_TYPE_SONG_TOP100:
{
- AddSortMethod(SORT_METHOD_NONE, 576, LABEL_MASKS("%T - %A", "%V"));
- SetSortMethod(SORT_METHOD_PLAYCOUNT);
+ AddSortMethod(SortByNone, 576, LABEL_MASKS("%T - %A", "%V"));
+ SetSortMethod(SortByPlaycount);
SetViewAsControl(CViewStateSettings::Get().Get("musicnavsongs")->m_viewMode);
@@ -376,31 +341,24 @@ void CGUIViewStateMusicDatabase::SaveViewState()
}
}
-
CGUIViewStateMusicSmartPlaylist::CGUIViewStateMusicSmartPlaylist(const CFileItemList& items) : CGUIViewStateWindowMusic(items)
{
+ SortAttribute sortAttribute = SortAttributeNone;
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
+ sortAttribute = SortAttributeIgnoreArticle;
+
if (items.GetContent() == "songs" || items.GetContent() == "mixed")
{
CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat");
CStdString strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright");
- AddSortMethod(SORT_METHOD_TRACKNUM, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined| empty, empty
- if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
- {
- AddSortMethod(SORT_METHOD_TITLE_IGNORE_THE, 556, LABEL_MASKS("%T - %A", "%D")); // Title, Artist, Duration| empty, empty
- AddSortMethod(SORT_METHOD_ALBUM_IGNORE_THE, 558, LABEL_MASKS("%B - %T - %A", "%D")); // Album, Titel, Artist, Duration| empty, empty
- AddSortMethod(SORT_METHOD_ARTIST_IGNORE_THE, 557, LABEL_MASKS("%A - %T", "%D")); // Artist, Titel, Duration| empty, empty
- AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551, LABEL_MASKS(strTrackLeft, strTrackRight));
- }
- else
- {
- AddSortMethod(SORT_METHOD_TITLE, 556, LABEL_MASKS("%T - %A", "%D")); // Title, Artist, Duration| empty, empty
- AddSortMethod(SORT_METHOD_ALBUM, 558, LABEL_MASKS("%B - %T - %A", "%D")); // Album, Titel, Artist, Duration| empty, empty
- AddSortMethod(SORT_METHOD_ARTIST, 557, LABEL_MASKS("%A - %T", "%D")); // Artist, Titel, Duration| empty, empty
- AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS(strTrackLeft, strTrackRight));
- }
- AddSortMethod(SORT_METHOD_DURATION, 180, LABEL_MASKS("%T - %A", "%D")); // Titel, Artist, Duration| empty, empty
- AddSortMethod(SORT_METHOD_SONG_RATING, 563, LABEL_MASKS("%T - %A", "%R")); // Titel, Artist, Rating| empty, empty
+ AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined| empty, empty
+ AddSortMethod(SortByTitle, sortAttribute, 556, LABEL_MASKS("%T - %A", "%D")); // Title, Artist, Duration| empty, empty
+ AddSortMethod(SortByAlbum, sortAttribute, 558, LABEL_MASKS("%B - %T - %A", "%D")); // Album, Titel, Artist, Duration| empty, empty
+ AddSortMethod(SortByArtist, sortAttribute, 557, LABEL_MASKS("%A - %T", "%D")); // Artist, Titel, Duration| empty, empty
+ AddSortMethod(SortByLabel, sortAttribute, 551, LABEL_MASKS(strTrackLeft, strTrackRight));
+ AddSortMethod(SortByTime, 180, LABEL_MASKS("%T - %A", "%D")); // Titel, Artist, Duration| empty, empty
+ AddSortMethod(SortByRating, 563, LABEL_MASKS("%T - %A", "%R")); // Titel, Artist, Rating| empty, empty
AddPlaylistOrder(items, LABEL_MASKS(strTrackLeft, strTrackRight));
SetViewAsControl(CViewStateSettings::Get().Get("musicnavsongs")->m_viewMode);
@@ -415,19 +373,11 @@ CGUIViewStateMusicSmartPlaylist::CGUIViewStateMusicSmartPlaylist(const CFileItem
strAlbumRight = "%A"; // artist
// album
- if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
- AddSortMethod(SORT_METHOD_ALBUM_IGNORE_THE, 558, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
- else
- AddSortMethod(SORT_METHOD_ALBUM, 558, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
-
+ AddSortMethod(SortByAlbum, sortAttribute, 558, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
// artist
- if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
- AddSortMethod(SORT_METHOD_ARTIST_IGNORE_THE, 557, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
- else
- AddSortMethod(SORT_METHOD_ARTIST, 557, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
-
+ AddSortMethod(SortByArtist, sortAttribute, 557, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight)); // Filename, empty | Userdefined, Userdefined
// year
- AddSortMethod(SORT_METHOD_YEAR, 562, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight));
+ AddSortMethod(SortByYear, 562, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight));
AddPlaylistOrder(items, LABEL_MASKS("%F", "", strAlbumLeft, strAlbumRight));
@@ -448,33 +398,26 @@ void CGUIViewStateMusicSmartPlaylist::SaveViewState()
CGUIViewStateMusicPlaylist::CGUIViewStateMusicPlaylist(const CFileItemList& items) : CGUIViewStateWindowMusic(items)
{
+ SortAttribute sortAttribute = SortAttributeNone;
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
+ sortAttribute = SortAttributeIgnoreArticle;
+
CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat");
CStdString strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright");
- AddSortMethod(SORT_METHOD_PLAYLIST_ORDER, 559, LABEL_MASKS(strTrackLeft, strTrackRight));
- AddSortMethod(SORT_METHOD_TRACKNUM, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined| empty, empty
- if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
- {
- AddSortMethod(SORT_METHOD_TITLE_IGNORE_THE, 556, LABEL_MASKS("%T - %A", "%D")); // Title, Artist, Duration| empty, empty
- AddSortMethod(SORT_METHOD_ALBUM_IGNORE_THE, 558, LABEL_MASKS("%B - %T - %A", "%D")); // Album, Titel, Artist, Duration| empty, empty
- AddSortMethod(SORT_METHOD_ARTIST_IGNORE_THE, 557, LABEL_MASKS("%A - %T", "%D")); // Artist, Titel, Duration| empty, empty
- AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551, LABEL_MASKS(strTrackLeft, strTrackRight));
- }
- else
- {
- AddSortMethod(SORT_METHOD_TITLE, 556, LABEL_MASKS("%T - %A", "%D")); // Title, Artist, Duration| empty, empty
- AddSortMethod(SORT_METHOD_ALBUM, 558, LABEL_MASKS("%B - %T - %A", "%D")); // Album, Titel, Artist, Duration| empty, empty
- AddSortMethod(SORT_METHOD_ARTIST, 557, LABEL_MASKS("%A - %T", "%D")); // Artist, Titel, Duration| empty, empty
- AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS(strTrackLeft, strTrackRight));
- }
- AddSortMethod(SORT_METHOD_DURATION, 180, LABEL_MASKS("%T - %A", "%D")); // Titel, Artist, Duration| empty, empty
- AddSortMethod(SORT_METHOD_SONG_RATING, 563, LABEL_MASKS("%T - %A", "%R")); // Titel, Artist, Rating| empty, empty
-
- SetSortMethod(SORT_METHOD_PLAYLIST_ORDER);
+ AddSortMethod(SortByPlaylistOrder, 559, LABEL_MASKS(strTrackLeft, strTrackRight));
+ AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined| empty, empty
+ AddSortMethod(SortByTitle, sortAttribute, 556, LABEL_MASKS("%T - %A", "%D")); // Title, Artist, Duration| empty, empty
+ AddSortMethod(SortByAlbum, sortAttribute, 558, LABEL_MASKS("%B - %T - %A", "%D")); // Album, Titel, Artist, Duration| empty, empty
+ AddSortMethod(SortByArtist, sortAttribute, 557, LABEL_MASKS("%A - %T", "%D")); // Artist, Titel, Duration| empty, empty
+ AddSortMethod(SortByLabel, sortAttribute, 551, LABEL_MASKS(strTrackLeft, strTrackRight));
+ AddSortMethod(SortByTime, 180, LABEL_MASKS("%T - %A", "%D")); // Titel, Artist, Duration| empty, empty
+ AddSortMethod(SortByRating, 563, LABEL_MASKS("%T - %A", "%R")); // Titel, Artist, Rating| empty, empty
+ SetSortMethod(SortByPlaylistOrder);
const CViewState *viewState = CViewStateSettings::Get().Get("musicfiles");
SetViewAsControl(viewState->m_viewMode);
- SetSortOrder(viewState->m_sortOrder);
+ SetSortOrder(viewState->m_sortDescription.sortOrder);
LoadViewState(items.GetPath(), WINDOW_MUSIC_FILES);
}
@@ -484,13 +427,16 @@ void CGUIViewStateMusicPlaylist::SaveViewState()
SaveViewToDb(m_items.GetPath(), WINDOW_MUSIC_FILES);
}
-
CGUIViewStateWindowMusicNav::CGUIViewStateWindowMusicNav(const CFileItemList& items) : CGUIViewStateWindowMusic(items)
{
+ SortAttribute sortAttribute = SortAttributeNone;
+ if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
+ sortAttribute = SortAttributeIgnoreArticle;
+
if (items.IsVirtualDirectoryRoot())
{
- AddSortMethod(SORT_METHOD_NONE, 551, LABEL_MASKS("%F", "%I", "%L", "")); // Filename, Size | Foldername, empty
- SetSortMethod(SORT_METHOD_NONE);
+ AddSortMethod(SortByNone, 551, LABEL_MASKS("%F", "%I", "%L", "")); // Filename, Size | Foldername, empty
+ SetSortMethod(SortByNone);
SetViewAsControl(DEFAULT_VIEW_LIST);
@@ -504,35 +450,25 @@ CGUIViewStateWindowMusicNav::CGUIViewStateWindowMusicNav(const CFileItemList& it
XFILE::CVideoDatabaseDirectory::GetQueryParams(items[CSettings::Get().GetBool("filelists.showparentdiritems")?1:0]->GetPath(),params);
if (params.GetMVideoId() != -1)
{
- if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
- AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551, LABEL_MASKS("%T", "%Y")); // Filename, Duration | Foldername, empty
- else
- AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%T", "%Y")); // Filename, Duration | Foldername, empty
- AddSortMethod(SORT_METHOD_YEAR,562, LABEL_MASKS("%T", "%Y"));
- if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
- {
- AddSortMethod(SORT_METHOD_ARTIST_IGNORE_THE,557, LABEL_MASKS("%A - %T", "%Y"));
- AddSortMethod(SORT_METHOD_ALBUM_IGNORE_THE,558, LABEL_MASKS("%B - %T", "%Y"));
- }
- else
- {
- AddSortMethod(SORT_METHOD_ARTIST,557, LABEL_MASKS("%A - %T", "%Y"));
- AddSortMethod(SORT_METHOD_ALBUM,558, LABEL_MASKS("%B - %T", "%Y"));
- }
+ AddSortMethod(SortByLabel, sortAttribute, 551, LABEL_MASKS("%T", "%Y")); // Filename, Duration | Foldername, empty
+ AddSortMethod(SortByYear, 562, LABEL_MASKS("%T", "%Y"));
+ AddSortMethod(SortByArtist, sortAttribute, 557, LABEL_MASKS("%A - %T", "%Y"));
+ AddSortMethod(SortByAlbum, sortAttribute, 558, LABEL_MASKS("%B - %T", "%Y"));
+
CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat");
CStdString strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright");
- AddSortMethod(SORT_METHOD_TRACKNUM, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined| empty, empty
+ AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS(strTrackLeft, strTrackRight)); // Userdefined, Userdefined| empty, empty
}
else
{
- AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%F", "%D", "%L", "")); // Filename, Duration | Foldername, empty
- SetSortMethod(SORT_METHOD_LABEL);
+ AddSortMethod(SortByLabel, 551, LABEL_MASKS("%F", "%D", "%L", "")); // Filename, Duration | Foldername, empty
+ SetSortMethod(SortByLabel);
}
}
else
{
- AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%F", "%D", "%L", "")); // Filename, Duration | Foldername, empty
- SetSortMethod(SORT_METHOD_LABEL);
+ AddSortMethod(SortByLabel, 551, LABEL_MASKS("%F", "%D", "%L", "")); // Filename, Duration | Foldername, empty
+ SetSortMethod(SortByLabel);
}
SetViewAsControl(DEFAULT_VIEW_LIST);
@@ -613,9 +549,9 @@ CGUIViewStateWindowMusicSongs::CGUIViewStateWindowMusicSongs(const CFileItemList
{
if (items.IsVirtualDirectoryRoot())
{
- AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS()); // Preformated
- AddSortMethod(SORT_METHOD_DRIVE_TYPE, 564, LABEL_MASKS()); // Preformated
- SetSortMethod(SORT_METHOD_LABEL);
+ AddSortMethod(SortByLabel, 551, LABEL_MASKS()); // Preformated
+ AddSortMethod(SortByDriveType, 564, LABEL_MASKS()); // Preformated
+ SetSortMethod(SortByLabel);
SetViewAsControl(DEFAULT_VIEW_LIST);
@@ -623,28 +559,26 @@ CGUIViewStateWindowMusicSongs::CGUIViewStateWindowMusicSongs(const CFileItemList
}
else if (items.GetPath() == "special://musicplaylists/")
{ // playlists list sorts by label only, ignoring folders
- AddSortMethod(SORT_METHOD_LABEL_IGNORE_FOLDERS, 551, LABEL_MASKS("%F", "%D", "%L", "")); // Filename, Duration | Foldername, empty
- SetSortMethod(SORT_METHOD_LABEL_IGNORE_FOLDERS);
+ AddSortMethod(SortByLabel, SortAttributeIgnoreFolders, 551, LABEL_MASKS("%F", "%D", "%L", "")); // Filename, Duration | Foldername, empty
+ SetSortMethod(SortByLabel, SortAttributeIgnoreFolders);
}
else
{
CStdString strTrackLeft=CSettings::Get().GetString("musicfiles.trackformat");
CStdString strTrackRight=CSettings::Get().GetString("musicfiles.trackformatright");
- if (CSettings::Get().GetBool("filelists.ignorethewhensorting"))
- AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551, LABEL_MASKS(strTrackLeft, strTrackRight, "%L", "")); // Userdefined, Userdefined | FolderName, empty
- else
- AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS(strTrackLeft, strTrackRight, "%L", "")); // Userdefined, Userdefined | FolderName, empty
- AddSortMethod(SORT_METHOD_SIZE, 553, LABEL_MASKS(strTrackLeft, "%I", "%L", "%I")); // Userdefined, Size | FolderName, Size
- AddSortMethod(SORT_METHOD_BITRATE, 623, LABEL_MASKS(strTrackLeft, "%X", "%L", "%X")); // Userdefined, Bitrate | FolderName, Bitrate
- AddSortMethod(SORT_METHOD_DATE, 552, LABEL_MASKS(strTrackLeft, "%J", "%L", "%J")); // Userdefined, Date | FolderName, Date
- AddSortMethod(SORT_METHOD_FILE, 561, LABEL_MASKS(strTrackLeft, strTrackRight, "%L", "")); // Userdefined, Userdefined | FolderName, empty
- AddSortMethod(SORT_METHOD_LISTENERS,20455,LABEL_MASKS(strTrackLeft, "%W", "%L", "%W"));
-
+ AddSortMethod(SortByLabel, 551, LABEL_MASKS(strTrackLeft, strTrackRight, "%L", ""), // Userdefined, Userdefined | FolderName, empty
+ CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SortAttributeIgnoreArticle : SortAttributeNone);
+ AddSortMethod(SortBySize, 553, LABEL_MASKS(strTrackLeft, "%I", "%L", "%I")); // Userdefined, Size | FolderName, Size
+ AddSortMethod(SortByBitrate, 623, LABEL_MASKS(strTrackLeft, "%X", "%L", "%X")); // Userdefined, Bitrate | FolderName, Bitrate
+ AddSortMethod(SortByDate, 552, LABEL_MASKS(strTrackLeft, "%J", "%L", "%J")); // Userdefined, Date | FolderName, Date
+ AddSortMethod(SortByFile, 561, LABEL_MASKS(strTrackLeft, strTrackRight, "%L", "")); // Userdefined, Userdefined | FolderName, empty
+ AddSortMethod(SortByListeners, 20455,LABEL_MASKS(strTrackLeft, "%W", "%L", "%W"));
+
const CViewState *viewState = CViewStateSettings::Get().Get("musicfiles");
- SetSortMethod(viewState->m_sortMethod);
+ SetSortMethod(viewState->m_sortDescription);
SetViewAsControl(viewState->m_viewMode);
- SetSortOrder(viewState->m_sortOrder);
+ SetSortOrder(viewState->m_sortDescription.sortOrder);
}
LoadViewState(items.GetPath(), WINDOW_MUSIC_FILES);
}
@@ -670,8 +604,8 @@ CGUIViewStateWindowMusicPlaylist::CGUIViewStateWindowMusicPlaylist(const CFileIt
if (strTrackRight.IsEmpty())
strTrackRight = CSettings::Get().GetString("musicfiles.trackformatright");
- AddSortMethod(SORT_METHOD_NONE, 551, LABEL_MASKS(strTrackLeft, strTrackRight, "%L", "")); // Userdefined, Userdefined | FolderName, empty
- SetSortMethod(SORT_METHOD_NONE);
+ AddSortMethod(SortByNone, 551, LABEL_MASKS(strTrackLeft, strTrackRight, "%L", "")); // Userdefined, Userdefined | FolderName, empty
+ SetSortMethod(SortByNone);
SetViewAsControl(DEFAULT_VIEW_LIST);
View
4 xbmc/music/infoscanner/MusicInfoScanner.cpp
@@ -390,7 +390,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, SortOrderAscending);
+ items.Sort(SortByLabel, SortOrderAscending);