Add "Play Random Song" option (#200)
It also respects the search string, so only visible tracks are chosen from the pool. Categories (i.e. entries with children) are also ignored.
This commit is contained in:
parent
56d7fff500
commit
bab10ea14d
@ -673,6 +673,7 @@ private slots:
|
||||
void music_fade_out(bool toggle);
|
||||
void music_fade_in(bool toggle);
|
||||
void music_synchronize(bool toggle);
|
||||
void music_random();
|
||||
void music_list_expand_all();
|
||||
void music_list_collapse_all();
|
||||
void on_area_list_double_clicked(QTreeWidgetItem *p_item, int column);
|
||||
|
@ -4098,6 +4098,9 @@ void Courtroom::on_music_list_context_menu_requested(const QPoint &pos)
|
||||
{
|
||||
QMenu *menu = new QMenu();
|
||||
|
||||
menu->addAction(QString(tr("Play Random Song")), this,
|
||||
SLOT(music_random()));
|
||||
menu->addSeparator();
|
||||
menu->addAction(QString(tr("Expand All Categories")), this,
|
||||
SLOT(music_list_expand_all()));
|
||||
menu->addAction(QString(tr("Collapse All Categories")), this,
|
||||
@ -4149,6 +4152,18 @@ void Courtroom::music_synchronize(bool toggle)
|
||||
music_flags &= ~SYNC_POS;
|
||||
}
|
||||
|
||||
void Courtroom::music_random()
|
||||
{
|
||||
QList<QTreeWidgetItem *> clist;
|
||||
QTreeWidgetItemIterator it(ui_music_list, QTreeWidgetItemIterator::NotHidden | QTreeWidgetItemIterator::NoChildren);
|
||||
while (*it) {
|
||||
clist += (*it);
|
||||
++it;
|
||||
}
|
||||
int i = qrand() % clist.length();
|
||||
on_music_list_double_clicked(clist.at(i), 1);
|
||||
}
|
||||
|
||||
void Courtroom::music_list_expand_all() { ui_music_list->expandAll(); }
|
||||
void Courtroom::music_list_collapse_all()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user