-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
woc #22
woc #22
Conversation
@@ -191,14 +192,23 @@ Song NextUpViewModel::getNextSong() { | |||
} | |||
case PlayMode::ListRepeat: { | |||
// TODO | |||
auto index = model.indexOf(song); | |||
index++; | |||
song = model[index]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if index == size - 1
?
break; | ||
} | ||
case PlayMode::Shuffle: { | ||
// TODO | ||
auto index = model.indexOf(song); | ||
srand(QTime(0,0,0).secsTo(QTime::currentTime())); | ||
auto random = rand() % model.count(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, using the modulus operator cannot obtain the uniform distribution.
Suggest using modern methods provided by C++ or Qt.
@@ -28,6 +28,8 @@ class SongLyricViewModel : public QAbstractListModel { | |||
|
|||
QHash<int, QByteArray> roleNames() const override; | |||
|
|||
QList<SongLyric> ProcessLyric (QString); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QList<SongLyric> ProcessLyric (QString); | |
QList<SongLyric> ProcessLyric(QString); |
Follow our code style defined in clang-format.yaml
, if there is no specific reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use pass by const reference for large object if you don't expect to change it 👀
无选做