aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorin1tiate <32779090+in1tiate@users.noreply.github.com>2021-01-09 09:14:56 -0600
committerGitHub <noreply@github.com>2021-01-09 18:14:56 +0300
commit7bac3c9514f2c5b01d0c49f60849d897993765db (patch)
tree6c66692255452c7618d5a960643ef0124c1d3a22
parent1da6e37e048572422346a821da21b7249eecf013 (diff)
only play expanded songs, music_random (#376)
-rw-r--r--src/courtroom.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index eb056653..9b549419 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -4295,11 +4295,14 @@ void Courtroom::music_random()
QTreeWidgetItemIterator::NotHidden |
QTreeWidgetItemIterator::NoChildren);
while (*it) {
- clist += (*it);
+ if ((*it)->parent()->isExpanded()) {
+ clist += (*it);
+ }
++it;
}
- int i = qrand() % clist.length();
- on_music_list_double_clicked(clist.at(i), 1);
+ if (clist.length() == 0)
+ return;
+ on_music_list_double_clicked(clist.at(qrand() % clist.length()), 1);
}
void Courtroom::music_list_expand_all() { ui_music_list->expandAll(); }