menu: remove Menu::hasSelected
This commit is contained in:
@@ -797,7 +797,7 @@ void Delete::Run()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
std::string question;
|
std::string question;
|
||||||
if (myBrowser->main().hasSelected())
|
if (hasSelected(myBrowser->main().begin(), myBrowser->main().end()))
|
||||||
question = "Delete selected items?";
|
question = "Delete selected items?";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -846,7 +846,7 @@ void Delete::Run()
|
|||||||
if (myScreen->isActiveWindow(myPlaylistEditor->Playlists))
|
if (myScreen->isActiveWindow(myPlaylistEditor->Playlists))
|
||||||
{
|
{
|
||||||
std::string question;
|
std::string question;
|
||||||
if (myPlaylistEditor->Playlists.hasSelected())
|
if (hasSelected(myPlaylistEditor->Playlists.begin(), myPlaylistEditor->Playlists.end()))
|
||||||
question = "Delete selected playlists?";
|
question = "Delete selected playlists?";
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
12
src/menu.h
12
src/menu.h
@@ -239,10 +239,6 @@ public:
|
|||||||
/// @return true if the position is reachable, false otherwise
|
/// @return true if the position is reachable, false otherwise
|
||||||
bool Goto(size_t y);
|
bool Goto(size_t y);
|
||||||
|
|
||||||
/// Checks whether list contains selected positions
|
|
||||||
/// @return true if it contains them, false otherwise
|
|
||||||
bool hasSelected() const;
|
|
||||||
|
|
||||||
/// Highlights given position
|
/// Highlights given position
|
||||||
/// @param pos position to be highlighted
|
/// @param pos position to be highlighted
|
||||||
void highlight(size_t pos);
|
void highlight(size_t pos);
|
||||||
@@ -774,14 +770,6 @@ template <typename T> void Menu<T>::clear()
|
|||||||
m_options_ptr = &m_options;
|
m_options_ptr = &m_options;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T> bool Menu<T>::hasSelected() const
|
|
||||||
{
|
|
||||||
for (auto it = begin(); it != end(); ++it)
|
|
||||||
if (it->isSelected())
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T> void Menu<T>::highlight(size_t pos)
|
template <typename T> void Menu<T>::highlight(size_t pos)
|
||||||
{
|
{
|
||||||
assert(pos < m_options_ptr->size());
|
assert(pos < m_options_ptr->size());
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
#include "helpers.h"
|
||||||
#include "playlist.h"
|
#include "playlist.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "sort_playlist.h"
|
#include "sort_playlist.h"
|
||||||
@@ -156,7 +157,7 @@ void SortPlaylistDialog::sort() const
|
|||||||
auto &pl = myPlaylist->main();
|
auto &pl = myPlaylist->main();
|
||||||
auto begin = pl.begin(), end = pl.end();
|
auto begin = pl.begin(), end = pl.end();
|
||||||
// if songs are selected, sort range from first selected to last selected
|
// if songs are selected, sort range from first selected to last selected
|
||||||
if (pl.hasSelected())
|
if (hasSelected(pl.begin(), pl.end()))
|
||||||
{
|
{
|
||||||
while (!begin->isSelected())
|
while (!begin->isSelected())
|
||||||
++begin;
|
++begin;
|
||||||
|
|||||||
@@ -451,7 +451,8 @@ void TagEditor::enterPressed()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
EditedSongs.clear();
|
EditedSongs.clear();
|
||||||
if (Tags->hasSelected()) // if there are selected songs, perform operations only on them
|
// if there are selected songs, perform operations only on them
|
||||||
|
if (hasSelected(Tags->begin(), Tags->end()))
|
||||||
{
|
{
|
||||||
for (auto it = Tags->begin(); it != Tags->end(); ++it)
|
for (auto it = Tags->begin(); it != Tags->end(); ++it)
|
||||||
if (it->isSelected())
|
if (it->isSelected())
|
||||||
|
|||||||
Reference in New Issue
Block a user