There seems to be the setting to change things but it doesn't seem to work for me on the latest git code and cmyth addon.
Looking at things more I still can't wrap my head around all the different classes on how the sort code works. I haven't been able to find docs to help describe how the classes are related.
It would seem CGUIWindowPVRCommon::m_iSort.. isn't connected to the CGUIMediaWindow and CGUIViewStateWindow values.
I was able to get this backtrace on things where the SortByDate button was pressed, but the sortBy var being passed into the sort still has the SortByLabel value.
(gdb) backtrace
#0 SortUtils::Sort (sortDescription=..., items=...) at SortUtils.cpp:705
#1 0x0000000001120132 in CFileItemList::Sort (this=0x27dc5f0, sortDescription=...) at FileItem.cpp:1957
#2 0x000000000111fe5a in CFileItemList::Sort (this=0x27dc5f0,
sortBy=SortByLabel, sortOrder=SortOrderDescending, sortAttributes=SortAttributeIgnoreArticle) at FileItem.cpp:1923
#3 0x00000000010d04a5 in CGUIMediaWindow::FormatAndSort (this=0x27dbea0, items=...) at GUIMediaWindow.cpp:637
#4 0x00000000010d515d in CGUIMediaWindow::UpdateFileList (this=0x27dbea0) at GUIMediaWindow.cpp:1399
#5 0x00000000010cedeb in CGUIMediaWindow::OnMessage (this=0x27dbea0, message=...) at GUIMediaWindow.cpp:480
#6 0x00000000014264a5 in PVR::CGUIWindowPVR::OnMessage (this=0x27dbea0, message=...) at GUIWindowPVR.cpp:185
#7 0x0000000000c254c6 in PVR::CGUIWindowPVRCommon::
OnContextButtonSortByDate (this=0x7fffa4003590, item=0x3787100, button=CONTEXT_BUTTON_SORTBY_DATE) at GUIWindowPVRCommon.cpp:239
===
I started to hack in CGUIViewStatePVR::CGUIViewStatePVR(), and this change gets things to sort by Date, but the button to switch still doesn't work.
Does anyone know why there is a + 100 - ActiveView?
Code:
}
- LoadViewState(items.GetPath(), ActiveView == PVR_WINDOW_UNKNOWN ? WINDOW_PVR : WINDOW_PVR + 100 - ActiveView );
+ CLog::Log(LOGERROR, "%s Doing LV", __FUNCTION__ );
+ SetViewAsControl(DEFAULT_VIEW_LIST);
+ LoadViewState(items.GetPath(), PVR_WINDOW_RECORDINGS);
+ //LoadViewState(items.GetPath(), ActiveView == PVR_WINDOW_UNKNOWN ? WINDOW_PVR : WINDOW_PVR + 100 - ActiveView );
}
Looking at something like CGUIViewStateWindowVideoFiles as a reference things are very different, but I have no idea why. I would think that is more the model to follow, but I am not sure what the PVR quirks would be on how things should be different.
Should we have a single const CViewState *viewState = CViewStateSettings::Get().Get("pvr");? Or does the "pvr" need to change depending on the activeview?