menu: add value iterator
This commit is contained in:
@@ -2205,7 +2205,7 @@ void ToggleBrowserSortMode::Run()
|
||||
ShowMessage("Sort songs by: Name");
|
||||
break;
|
||||
}
|
||||
std::sort(myBrowser->Main()->Begin()+(myBrowser->CurrentDir() != "/"), myBrowser->Main()->End(), CaseInsensitiveSorting());
|
||||
std::sort(myBrowser->Main()->BeginV()+(myBrowser->CurrentDir() != "/"), myBrowser->Main()->EndV(), CaseInsensitiveSorting());
|
||||
}
|
||||
|
||||
bool ToggleLibraryTagType::canBeRun() const
|
||||
|
||||
@@ -248,7 +248,7 @@ void MediaLibrary::Update()
|
||||
}
|
||||
utf_to_locale(Artists->Current().value());
|
||||
if (!Albums->Empty())
|
||||
std::sort(Albums->Begin(), Albums->End(), SearchConstraintsSorting());
|
||||
std::sort(Albums->BeginV(), Albums->EndV(), SearchConstraintsSorting());
|
||||
if (Albums->Size() > 1)
|
||||
{
|
||||
Albums->AddSeparator();
|
||||
@@ -306,7 +306,7 @@ void MediaLibrary::Update()
|
||||
}
|
||||
Mpd.BlockIdle(0);
|
||||
if (!Albums->Empty())
|
||||
std::sort(Albums->Begin(), Albums->End(), SearchConstraintsSorting());
|
||||
std::sort(Albums->BeginV(), Albums->EndV(), SearchConstraintsSorting());
|
||||
Albums->Refresh();
|
||||
}
|
||||
|
||||
@@ -334,9 +334,9 @@ void MediaLibrary::Update()
|
||||
});
|
||||
|
||||
if (Albums->Current().value().Date == AllTracksMarker)
|
||||
std::sort(Songs->Begin(), Songs->End(), SortAllTracks);
|
||||
std::sort(Songs->BeginV(), Songs->EndV(), SortAllTracks);
|
||||
else
|
||||
std::sort(Songs->Begin(), Songs->End(), SortSongsByTrack);
|
||||
std::sort(Songs->BeginV(), Songs->EndV(), SortSongsByTrack);
|
||||
|
||||
Songs->Window::Clear();
|
||||
Songs->Refresh();
|
||||
|
||||
28
src/menu.h
28
src/menu.h
@@ -215,16 +215,25 @@ template <typename T> struct Menu : public Window, public List
|
||||
};
|
||||
|
||||
typedef ItemIterator<
|
||||
T, typename std::vector<Item *>::iterator
|
||||
Item, typename std::vector<Item *>::iterator
|
||||
> Iterator;
|
||||
|
||||
typedef ItemIterator<
|
||||
typename std::add_const<T>::type, typename std::vector<Item *>::const_iterator
|
||||
const Item, typename std::vector<Item *>::const_iterator
|
||||
> ConstIterator;
|
||||
|
||||
typedef std::reverse_iterator<Iterator> ReverseIterator;
|
||||
typedef std::reverse_iterator<ConstIterator> ConstReverseIterator;
|
||||
|
||||
typedef ItemIterator<
|
||||
T, typename std::vector<Item *>::iterator
|
||||
> ValueIterator;
|
||||
typedef ItemIterator<
|
||||
typename std::add_const<T>::type, typename std::vector<Item *>::const_iterator
|
||||
> ConstValueIterator;
|
||||
|
||||
typedef std::reverse_iterator<ValueIterator> ReverseValueIterator;
|
||||
typedef std::reverse_iterator<ConstValueIterator> ConstReverseValueIterator;
|
||||
|
||||
/// Constructs an empty menu with given parameters
|
||||
/// @param startx X position of left upper corner of constructed menu
|
||||
/// @param starty Y position of left upper corner of constructed menu
|
||||
@@ -522,15 +531,23 @@ template <typename T> struct Menu : public Window, public List
|
||||
|
||||
Iterator Begin() { return Iterator(m_options_ptr->begin()); }
|
||||
ConstIterator Begin() const { return ConstIterator(m_options_ptr->begin()); }
|
||||
|
||||
Iterator End() { return Iterator(m_options_ptr->end()); }
|
||||
ConstIterator End() const { return ConstIterator(m_options_ptr->end()); }
|
||||
|
||||
ReverseIterator Rbegin() { return ReverseIterator(End()); }
|
||||
ConstReverseIterator Rbegin() const { return ConstReverseIterator(End()); }
|
||||
|
||||
ReverseIterator Rend() { return ReverseIterator(Begin()); }
|
||||
ConstReverseIterator Rend() const { return ConstReverseIterator(Begin()); }
|
||||
|
||||
ValueIterator BeginV() { return ValueIterator(m_options_ptr->begin()); }
|
||||
ConstValueIterator BeginV() const { return ConstValueIterator(m_options_ptr->begin()); }
|
||||
ValueIterator EndV() { return ValueIterator(m_options_ptr->end()); }
|
||||
ConstValueIterator EndV() const { return ConstValueIterator(m_options_ptr->end()); }
|
||||
|
||||
ReverseValueIterator RbeginV() { return ReverseValueIterator(End()); }
|
||||
ConstReverseIterator RbeginV() const { return ConstReverseValueIterator(End()); }
|
||||
ReverseValueIterator RendV() { return ReverseValueIterator(Begin()); }
|
||||
ConstReverseValueIterator RendV() const { return ConstReverseValueIterator(Begin()); }
|
||||
|
||||
private:
|
||||
/// Clears filter, filtered data etc.
|
||||
@@ -1063,4 +1080,3 @@ template <typename T> typename Menu<T>::Item &Menu<T>::operator[](size_t pos)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -255,7 +255,7 @@ void TagEditor::Update()
|
||||
Albums->AddItem(std::make_pair(l[0].toString(Config.tag_editor_album_format), *it));
|
||||
}
|
||||
Mpd.BlockIdle(0);
|
||||
std::sort(Albums->Begin(), Albums->End(), CaseInsensitiveSorting());
|
||||
std::sort(Albums->BeginV(), Albums->EndV(), CaseInsensitiveSorting());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user