Use static_cast

This commit is contained in:
Jonas Kvinge
2021-03-21 18:53:02 +01:00
parent f91a679cdf
commit 59bffed47f
80 changed files with 241 additions and 242 deletions

View File

@@ -214,7 +214,7 @@ struct Song::Private : public QSharedData {
QString cue_path_; // If the song has a CUE, this contains it's path.
float rating_; // Database rating, not read from tags.
double rating_; // Database rating, not read from tags.
QUrl stream_url_; // Temporary stream url set by url handler.
QImage image_; // Album Cover image set by album cover loader.
@@ -360,7 +360,7 @@ const QImage &Song::image() const { return d->image_; }
const QString &Song::cue_path() const { return d->cue_path_; }
bool Song::has_cue() const { return !d->cue_path_.isEmpty(); }
float Song::rating() const { return d->rating_; }
double Song::rating() const { return d->rating_; }
bool Song::is_collection_song() const { return d->source_ == Source_Collection; }
bool Song::is_metadata_good() const { return !d->url_.isEmpty() && !d->artist_.isEmpty() && !d->title_.isEmpty(); }
@@ -461,7 +461,7 @@ void Song::set_art_automatic(const QUrl &v) { d->art_automatic_ = v; }
void Song::set_art_manual(const QUrl &v) { d->art_manual_ = v; }
void Song::set_cue_path(const QString &v) { d->cue_path_ = v; }
void Song::set_rating(float v) { d->rating_ = v; }
void Song::set_rating(double v) { d->rating_ = v; }
void Song::set_stream_url(const QUrl &v) { d->stream_url_ = v; }
void Song::set_image(const QImage &i) { d->image_ = i; }
@@ -844,7 +844,7 @@ void Song::ToProtobuf(spb::tagreader::SongMetadata *pb) const {
#define tostr(n) (q.value(n).isNull() ? QString() : q.value(n).toString())
#define toint(n) (q.value(n).isNull() ? -1 : q.value(n).toInt())
#define tolonglong(n) (q.value(n).isNull() ? -1 : q.value(n).toLongLong())
#define tofloat(n) (q.value(n).isNull() ? -1 : q.value(n).toDouble())
#define todouble(n) (q.value(n).isNull() ? -1 : q.value(n).toDouble())
void Song::InitFromQuery(const SqlRow &q, bool reliable_metadata, int col) {
@@ -1013,7 +1013,7 @@ void Song::InitFromQuery(const SqlRow &q, bool reliable_metadata, int col) {
}
else if (Song::kColumns.value(i) == "rating") {
d->rating_ = tofloat(x);
d->rating_ = todouble(x);
}
else {
@@ -1029,7 +1029,7 @@ void Song::InitFromQuery(const SqlRow &q, bool reliable_metadata, int col) {
#undef tostr
#undef toint
#undef tolonglong
#undef tofloat
#undef todouble
}
@@ -1474,7 +1474,7 @@ QString Song::SampleRateBitDepthToText() const {
QString Song::PrettyRating() const {
float rating = d->rating_;
double rating = d->rating_;
if (rating == -1.0f) return "0";