Fix narrowing conversions
This commit is contained in:
parent
a704412dee
commit
79ac53b2d9
@ -396,7 +396,7 @@ void SingleApplicationPrivate::readInitMessageBody(QLocalSocket *sock) {
|
||||
}
|
||||
|
||||
// Read the message body
|
||||
QByteArray msgBytes = sock->read(info.msgLen);
|
||||
QByteArray msgBytes = sock->read(static_cast<qint64>(info.msgLen));
|
||||
QDataStream readStream(msgBytes);
|
||||
readStream.setVersion(QDataStream::Qt_5_8);
|
||||
|
||||
|
@ -396,7 +396,7 @@ void SingleCoreApplicationPrivate::readInitMessageBody(QLocalSocket *sock) {
|
||||
}
|
||||
|
||||
// Read the message body
|
||||
QByteArray msgBytes = sock->read(info.msgLen);
|
||||
QByteArray msgBytes = sock->read(static_cast<qint64>(info.msgLen));
|
||||
QDataStream readStream(msgBytes);
|
||||
readStream.setVersion(QDataStream::Qt_5_8);
|
||||
|
||||
|
@ -55,7 +55,7 @@ struct InstancesInfo {
|
||||
|
||||
struct ConnectionInfo {
|
||||
explicit ConnectionInfo() : msgLen(0), instanceId(0), stage(0) {}
|
||||
qint64 msgLen;
|
||||
quint64 msgLen;
|
||||
quint32 instanceId;
|
||||
quint8 stage;
|
||||
};
|
||||
|
@ -212,9 +212,9 @@ static QString ParsePrettyFunction(const char *pretty_function) {
|
||||
|
||||
// Get the class name out of the function name.
|
||||
QString class_name = pretty_function;
|
||||
const int paren = class_name.indexOf('(');
|
||||
const qint64 paren = class_name.indexOf('(');
|
||||
if (paren != -1) {
|
||||
const int colons = class_name.lastIndexOf("::", paren);
|
||||
const qint64 colons = class_name.lastIndexOf("::", paren);
|
||||
if (colons != -1) {
|
||||
class_name = class_name.left(colons);
|
||||
}
|
||||
@ -223,7 +223,7 @@ static QString ParsePrettyFunction(const char *pretty_function) {
|
||||
}
|
||||
}
|
||||
|
||||
const int space = class_name.lastIndexOf(' ');
|
||||
const qint64 space = class_name.lastIndexOf(' ');
|
||||
if (space != -1) {
|
||||
class_name = class_name.mid(space + 1);
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ void _MessageHandlerBase::WriteMessage(const QByteArray &data) {
|
||||
|
||||
QDataStream s(device_);
|
||||
s << quint32(data.length());
|
||||
s.writeRawData(data.data(), data.length());
|
||||
s.writeRawData(data.data(), static_cast<int>(data.length()));
|
||||
|
||||
// Sorry.
|
||||
if (flush_abstract_socket_) {
|
||||
|
@ -58,7 +58,7 @@ message SongMetadata {
|
||||
optional string url = 21;
|
||||
optional string basefilename = 22;
|
||||
optional FileType filetype = 23;
|
||||
optional int32 filesize = 24;
|
||||
optional int64 filesize = 24;
|
||||
optional int64 mtime = 25;
|
||||
optional int64 ctime = 26;
|
||||
|
||||
@ -69,7 +69,7 @@ message SongMetadata {
|
||||
|
||||
optional string art_automatic = 31;
|
||||
|
||||
optional float rating = 32;
|
||||
optional double rating = 32;
|
||||
|
||||
optional bool suspicious_tags = 40;
|
||||
|
||||
|
@ -222,8 +222,8 @@ void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMeta
|
||||
Decode(tag->artist(), song->mutable_artist()); // TPE1
|
||||
Decode(tag->album(), song->mutable_album());
|
||||
Decode(tag->genre(), song->mutable_genre());
|
||||
song->set_year(tag->year());
|
||||
song->set_track(tag->track());
|
||||
song->set_year(static_cast<int>(tag->year()));
|
||||
song->set_track(static_cast<int>(tag->track()));
|
||||
song->set_valid(true);
|
||||
}
|
||||
|
||||
@ -332,7 +332,7 @@ void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMeta
|
||||
const TagLib::ID3v2::PopularimeterFrame *frame = dynamic_cast<const TagLib::ID3v2::PopularimeterFrame*>(map["POPM"].front());
|
||||
if (frame) {
|
||||
if (song->playcount() <= 0 && frame->counter() > 0) {
|
||||
song->set_playcount(frame->counter());
|
||||
song->set_playcount(static_cast<int>(frame->counter()));
|
||||
}
|
||||
if (song->rating() <= 0 && frame->rating() > 0) {
|
||||
song->set_rating(ConvertPOPMRating(frame->rating()));
|
||||
@ -384,7 +384,7 @@ void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMeta
|
||||
{
|
||||
TagLib::MP4::Item item = mp4_tag->item(kMP4_FMPS_Playcount_ID);
|
||||
if (item.isValid()) {
|
||||
const int playcount = TStringToQString(item.toStringList().toString('\n')).toDouble();
|
||||
const int playcount = TStringToQString(item.toStringList().toString('\n')).toInt();
|
||||
if (song->playcount() <= 0 && playcount > 0) {
|
||||
song->set_playcount(playcount);
|
||||
}
|
||||
@ -463,7 +463,7 @@ void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMeta
|
||||
}
|
||||
|
||||
if (!disc.isEmpty()) {
|
||||
const int i = disc.indexOf('/');
|
||||
const qint64 i = disc.indexOf('/');
|
||||
if (i != -1) {
|
||||
// disc.right( i ).toInt() is total number of discs, we don't use this at the moment
|
||||
song->set_disc(disc.left(i).toInt());
|
||||
@ -530,7 +530,7 @@ void TagReaderTagLib::ParseOggTag(const TagLib::Ogg::FieldListMap &map, QString
|
||||
if (!map["COVERART"].isEmpty()) song->set_art_automatic(kEmbeddedCover);
|
||||
if (!map["METADATA_BLOCK_PICTURE"].isEmpty()) song->set_art_automatic(kEmbeddedCover);
|
||||
|
||||
if (!map["FMPS_PLAYCOUNT"].isEmpty() && song->playcount() <= 0) song->set_playcount(TStringToQString(map["FMPS_PLAYCOUNT"].front()).trimmed().toDouble());
|
||||
if (!map["FMPS_PLAYCOUNT"].isEmpty() && song->playcount() <= 0) song->set_playcount(TStringToQString(map["FMPS_PLAYCOUNT"].front()).trimmed().toInt());
|
||||
if (!map["FMPS_RATING"].isEmpty() && song->rating() <= 0) song->set_rating(TStringToQString(map["FMPS_RATING"].front()).trimmed().toDouble());
|
||||
|
||||
if (!map["LYRICS"].isEmpty()) Decode(map["LYRICS"].front(), song->mutable_lyrics());
|
||||
@ -574,7 +574,7 @@ void TagReaderTagLib::ParseAPETag(const TagLib::APE::ItemListMap &map, QString *
|
||||
}
|
||||
|
||||
if (map.contains("FMPS_PLAYCOUNT")) {
|
||||
const int playcount = TStringToQString(map["FMPS_PLAYCOUNT"].toString()).toDouble();
|
||||
const int playcount = TStringToQString(map["FMPS_PLAYCOUNT"].toString()).toInt();
|
||||
if (song->playcount() <= 0 && playcount > 0) {
|
||||
song->set_playcount(playcount);
|
||||
}
|
||||
@ -1025,7 +1025,7 @@ TagLib::ID3v2::PopularimeterFrame *TagReaderTagLib::GetPOPMFrameFromTag(TagLib::
|
||||
|
||||
double TagReaderTagLib::ConvertPOPMRating(const int POPM_rating) {
|
||||
|
||||
if (POPM_rating < 0x01) return 0.0;
|
||||
if (POPM_rating < 0x01) return 0.0;
|
||||
else if (POPM_rating < 0x40) return 0.20;
|
||||
else if (POPM_rating < 0x80) return 0.40;
|
||||
else if (POPM_rating < 0xC0) return 0.60;
|
||||
@ -1037,7 +1037,7 @@ double TagReaderTagLib::ConvertPOPMRating(const int POPM_rating) {
|
||||
|
||||
int TagReaderTagLib::ConvertToPOPMRating(const double rating) {
|
||||
|
||||
if (rating < 0.20) return 0x00;
|
||||
if (rating < 0.20) return 0x00;
|
||||
else if (rating < 0.40) return 0x01;
|
||||
else if (rating < 0.60) return 0x40;
|
||||
else if (rating < 0.80) return 0x80;
|
||||
|
@ -48,7 +48,7 @@ void TagReaderWorker::MessageArrived(const spb::tagreader::Message &message) {
|
||||
reply.mutable_load_embedded_art_response()->set_data(data.constData(), data.size());
|
||||
}
|
||||
else if (message.has_save_embedded_art_request()) {
|
||||
reply.mutable_save_embedded_art_response()->set_success(tag_reader_.SaveEmbeddedArt(QStringFromStdString(message.save_embedded_art_request().filename()), QByteArray(message.save_embedded_art_request().data().data(), message.save_embedded_art_request().data().size())));
|
||||
reply.mutable_save_embedded_art_response()->set_success(tag_reader_.SaveEmbeddedArt(QStringFromStdString(message.save_embedded_art_request().filename()), QByteArray(message.save_embedded_art_request().data().data(), static_cast<qint64>(message.save_embedded_art_request().data().size()))));
|
||||
}
|
||||
|
||||
else if (message.has_save_song_playcount_to_file_request()) {
|
||||
|
@ -180,7 +180,7 @@ void Analyzer::Base::demo(QPainter &p) {
|
||||
|
||||
const double dt = static_cast<double>(t) / 200;
|
||||
for (uint i = 0; i < s.size(); ++i) {
|
||||
s[i] = dt * (sin(M_PI + (i * M_PI) / s.size()) + 1.0);
|
||||
s[i] = static_cast<float>(dt * (sin(M_PI + (i * M_PI) / static_cast<double>(s.size())) + 1.0));
|
||||
}
|
||||
|
||||
analyze(p, s, new_frame_);
|
||||
@ -200,7 +200,7 @@ void Analyzer::Base::polishEvent() {
|
||||
void Analyzer::interpolate(const Scope &inVec, Scope &outVec) {
|
||||
|
||||
double pos = 0.0;
|
||||
const double step = static_cast<double>(inVec.size()) / outVec.size();
|
||||
const double step = static_cast<double>(inVec.size()) / static_cast<double>(outVec.size());
|
||||
|
||||
for (uint i = 0; i < outVec.size(); ++i, pos += step) {
|
||||
const double error = pos - std::floor(pos);
|
||||
@ -218,7 +218,7 @@ void Analyzer::interpolate(const Scope &inVec, Scope &outVec) {
|
||||
indexRight = inVec.size() - 1;
|
||||
}
|
||||
|
||||
outVec[i] = inVec[indexLeft] * (1.0 - error) + inVec[indexRight] * error;
|
||||
outVec[i] = inVec[indexLeft] * (1.0F - static_cast<float>(error)) + inVec[indexRight] * static_cast<float>(error);
|
||||
}
|
||||
|
||||
}
|
||||
@ -229,7 +229,7 @@ void Analyzer::initSin(Scope &v, const uint size) {
|
||||
double radian = 0;
|
||||
|
||||
for (uint i = 0; i < size; i++) {
|
||||
v.push_back(sin(radian));
|
||||
v.push_back(static_cast<float>(sin(radian)));
|
||||
radian += step;
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ void BoomAnalyzer::resizeEvent(QResizeEvent *e) {
|
||||
|
||||
QWidget::resizeEvent(e);
|
||||
|
||||
const uint HEIGHT = height() - 2;
|
||||
const int HEIGHT = height() - 2;
|
||||
const double h = 1.2 / HEIGHT;
|
||||
|
||||
bands_ = qMin(static_cast<int>(static_cast<double>(width() + 1) / (kColumnWidth + 1)) + 1, kMaxBandCount);
|
||||
@ -88,7 +88,7 @@ void BoomAnalyzer::resizeEvent(QResizeEvent *e) {
|
||||
canvas_.fill(palette().color(QPalette::Window));
|
||||
|
||||
QPainter p(&barPixmap_);
|
||||
for (uint y = 0; y < HEIGHT; ++y) {
|
||||
for (int y = 0; y < HEIGHT; ++y) {
|
||||
const double F = static_cast<double>(y) * h;
|
||||
|
||||
p.setPen(QColor(qMax(0, 255 - static_cast<int>(229.0 * F)),
|
||||
|
@ -53,8 +53,8 @@ void FHT::makeCasTable(void) {
|
||||
float *sintab = tab_() + num_ / 2 + 1;
|
||||
|
||||
for (int ul = 0; ul < num_; ul++) {
|
||||
float d = M_PI * ul / (num_ / 2); // NOLINT(bugprone-integer-division)
|
||||
*costab = *sintab = cos(d);
|
||||
double d = M_PI * static_cast<double>(ul) / (static_cast<double>(num_) / 2.0);
|
||||
*costab = *sintab = static_cast<float>(cos(d));
|
||||
|
||||
costab += 2;
|
||||
sintab += 2;
|
||||
@ -73,25 +73,25 @@ void FHT::ewma(float *d, float *s, float w) const {
|
||||
|
||||
void FHT::logSpectrum(float *out, float *p) {
|
||||
|
||||
int n = num_ / 2, i = 0, j = 0, k = 0, *r = nullptr;
|
||||
int n = num_ / 2, i = 0, k = 0, *r = nullptr;
|
||||
if (log_vector_.size() < n) {
|
||||
log_vector_.resize(n);
|
||||
float f = n / log10(static_cast<double>(n));
|
||||
float f = static_cast<float>(n) / static_cast<float>(log10(static_cast<float>(n)));
|
||||
for (i = 0, r = log_(); i < n; i++, r++) {
|
||||
j = static_cast<int>(rint(log10(i + 1.0) * f));
|
||||
int j = static_cast<int>(rint(log10(i + 1.0) * f));
|
||||
*r = j >= n ? n - 1 : j;
|
||||
}
|
||||
}
|
||||
semiLogSpectrum(p);
|
||||
*out++ = *p = *p / 100;
|
||||
for (k = i = 1, r = log_(); i < n; i++) {
|
||||
j = *r++;
|
||||
int j = *r++;
|
||||
if (i == j) {
|
||||
*out++ = p[i];
|
||||
}
|
||||
else {
|
||||
float base = p[k - 1];
|
||||
float step = (p[j] - base) / (j - (k - 1));
|
||||
float step = (p[j] - base) / static_cast<float>(j - (k - 1));
|
||||
for (float corr = 0; k <= j; k++, corr += step) *out++ = base + corr;
|
||||
}
|
||||
}
|
||||
@ -102,7 +102,7 @@ void FHT::semiLogSpectrum(float *p) {
|
||||
|
||||
power2(p);
|
||||
for (int i = 0; i < (num_ / 2); i++, p++) {
|
||||
float e = 10.0 * log10(sqrt(*p / 2));
|
||||
float e = 10.0F * static_cast<float>(log10(sqrt(*p / static_cast<float>(2))));
|
||||
*p = e < 0 ? 0 : e;
|
||||
}
|
||||
|
||||
@ -158,8 +158,8 @@ void FHT::transform8(float *p) {
|
||||
|
||||
a = *p++, b = *p++, c = *p++, d = *p++;
|
||||
e = *p++, f = *p++, g = *p++, h = *p;
|
||||
b_f2 = (b - f) * M_SQRT2;
|
||||
d_h2 = (d - h) * M_SQRT2;
|
||||
b_f2 = (b - f) * static_cast<float>(M_SQRT2);
|
||||
d_h2 = (d - h) * static_cast<float>(M_SQRT2);
|
||||
|
||||
a_c_eg = a - c - e + g;
|
||||
a_ce_g = a - c + e - g;
|
||||
|
@ -76,7 +76,7 @@ Rainbow::RainbowAnalyzer::RainbowAnalyzer(const RainbowType rbtype, QWidget *par
|
||||
|
||||
// pow constants computed so that
|
||||
// | band_scale(0) | ~= .5 and | band_scale(5) | ~= 32
|
||||
band_scale_[i] = -std::cos(M_PI * i / (kRainbowBands - 1)) * 0.5 * std::pow(2.3, i);
|
||||
band_scale_[i] = -static_cast<float>(std::cos(M_PI * i / (kRainbowBands - 1))) * 0.5F * static_cast<float>(std::pow(2.3, i));
|
||||
}
|
||||
|
||||
}
|
||||
@ -103,7 +103,7 @@ void Rainbow::RainbowAnalyzer::resizeEvent(QResizeEvent *e) {
|
||||
buffer_[1] = QPixmap();
|
||||
|
||||
available_rainbow_width_ = width() - kWidth[rainbowtype] + kRainbowOverlap[rainbowtype];
|
||||
px_per_frame_ = static_cast<float>(available_rainbow_width_) / (kHistorySize - 1) + 1;
|
||||
px_per_frame_ = available_rainbow_width_ / (kHistorySize - 1) + 1;
|
||||
x_offset_ = px_per_frame_ * (kHistorySize - 1) - available_rainbow_width_;
|
||||
|
||||
}
|
||||
@ -144,7 +144,7 @@ void Rainbow::RainbowAnalyzer::analyze(QPainter &p, const Analyzer::Scope &s, bo
|
||||
const float top_of = static_cast<float>(height()) / 2 - static_cast<float>(kRainbowHeight[rainbowtype]) / 2;
|
||||
for (int band = 0; band < kRainbowBands; ++band) {
|
||||
// Calculate the Y position of this band.
|
||||
const float y = static_cast<float>(kRainbowHeight[rainbowtype]) / (kRainbowBands + 1) * (band + 0.5) + top_of;
|
||||
const float y = static_cast<float>(kRainbowHeight[rainbowtype]) / static_cast<float>(kRainbowBands + 1) * (static_cast<float>(band) + 0.5F) + top_of;
|
||||
|
||||
// Add each point in the line.
|
||||
for (int x = 0; x < kHistorySize; ++x) {
|
||||
|
@ -197,7 +197,7 @@ void SCollection::SyncPlaycountAndRatingToFiles() {
|
||||
app_->task_manager()->SetTaskBlocksCollectionScans(task_id);
|
||||
|
||||
const SongList songs = backend_->GetAllSongs();
|
||||
const int nb_songs = songs.size();
|
||||
const qint64 nb_songs = songs.size();
|
||||
int i = 0;
|
||||
for (const Song &song : songs) {
|
||||
TagReaderClient::Instance()->UpdateSongPlaycountBlocking(song);
|
||||
|
@ -177,7 +177,7 @@ void CollectionBackend::ChangeDirPath(const int id, const QString &old_path, con
|
||||
const QByteArray old_url = QUrl::fromLocalFile(old_path).toEncoded();
|
||||
const QByteArray new_url = QUrl::fromLocalFile(new_path).toEncoded();
|
||||
|
||||
const int path_len = old_url.length();
|
||||
const qint64 path_len = old_url.length();
|
||||
|
||||
// Do the subdirs table
|
||||
{
|
||||
@ -709,7 +709,8 @@ void CollectionBackend::UpdateSongsBySongID(const SongMap &new_songs) {
|
||||
}
|
||||
|
||||
// Add or update songs.
|
||||
for (const Song &new_song : new_songs) {
|
||||
QList new_songs_list = new_songs.values();
|
||||
for (const Song &new_song : new_songs_list) {
|
||||
if (old_songs.contains(new_song.song_id())) {
|
||||
|
||||
Song old_song = old_songs[new_song.song_id()];
|
||||
@ -779,7 +780,8 @@ void CollectionBackend::UpdateSongsBySongID(const SongMap &new_songs) {
|
||||
}
|
||||
|
||||
// Delete songs
|
||||
for (const Song &old_song : old_songs) {
|
||||
QList old_songs_list = old_songs.values();
|
||||
for (const Song &old_song : old_songs_list) {
|
||||
if (!new_songs.contains(old_song.song_id())) {
|
||||
{
|
||||
SqlQuery q(db);
|
||||
@ -1109,7 +1111,7 @@ SongList CollectionBackend::GetSongsByForeignId(const QStringList &ids, const QS
|
||||
QVector<Song> ret(ids.count());
|
||||
while (q.next()) {
|
||||
const QString foreign_id = q.value(static_cast<int>(Song::kColumns.count()) + 1).toString();
|
||||
const int index = ids.indexOf(foreign_id);
|
||||
const qint64 index = ids.indexOf(foreign_id);
|
||||
if (index == -1) continue;
|
||||
|
||||
ret[index].InitFromQuery(q, true);
|
||||
|
@ -295,7 +295,7 @@ CollectionItem *CollectionModel::CreateCompilationArtistNode(const bool signal,
|
||||
|
||||
Q_ASSERT(parent->compilation_artist_node_ == nullptr);
|
||||
|
||||
if (signal) beginInsertRows(ItemToIndex(parent), parent->children.count(), parent->children.count());
|
||||
if (signal) beginInsertRows(ItemToIndex(parent), static_cast<int>(parent->children.count()), static_cast<int>(parent->children.count()));
|
||||
|
||||
parent->compilation_artist_node_ = new CollectionItem(CollectionItem::Type_Container, parent);
|
||||
parent->compilation_artist_node_->compilation_artist_node_ = nullptr;
|
||||
@ -1179,7 +1179,7 @@ CollectionItem *CollectionModel::InitItem(const GroupBy type, const bool signal,
|
||||
|
||||
CollectionItem::Type item_type = type == GroupBy_None ? CollectionItem::Type_Song : CollectionItem::Type_Container;
|
||||
|
||||
if (signal) beginInsertRows(ItemToIndex(parent), parent->children.count(), parent->children.count());
|
||||
if (signal) beginInsertRows(ItemToIndex(parent), static_cast<int>(parent->children.count()), static_cast<int>(parent->children.count()));
|
||||
|
||||
// Initialize the item depending on what type it's meant to be
|
||||
CollectionItem *item = new CollectionItem(item_type, parent);
|
||||
@ -1600,7 +1600,7 @@ void CollectionModel::FinishItem(const GroupBy type, const bool signal, const bo
|
||||
|
||||
if (!divider_key.isEmpty() && !divider_nodes_.contains(divider_key)) {
|
||||
if (signal) {
|
||||
beginInsertRows(ItemToIndex(parent), parent->children.count(), parent->children.count());
|
||||
beginInsertRows(ItemToIndex(parent), static_cast<int>(parent->children.count()), static_cast<int>(parent->children.count()));
|
||||
}
|
||||
|
||||
CollectionItem *divider = new CollectionItem(CollectionItem::Type_Divider, root_);
|
||||
@ -1679,7 +1679,7 @@ QString CollectionModel::SortTextForArtist(QString artist) {
|
||||
|
||||
for (const auto &i : Song::kArticles) {
|
||||
if (artist.startsWith(i)) {
|
||||
int ilen = i.length();
|
||||
qint64 ilen = i.length();
|
||||
artist = artist.right(artist.length() - ilen) + ", " + i.left(ilen - 1);
|
||||
break;
|
||||
}
|
||||
|
@ -520,10 +520,10 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const Subdirectory
|
||||
}
|
||||
|
||||
// CUE sheet's path from collection (if any).
|
||||
qint64 matching_song_cue_mtime = GetMtimeForCue(matching_song.cue_path());
|
||||
qint64 matching_song_cue_mtime = static_cast<qint64>(GetMtimeForCue(matching_song.cue_path()));
|
||||
|
||||
// CUE sheet's path from this file (if any).
|
||||
qint64 new_cue_mtime = GetMtimeForCue(new_cue);
|
||||
qint64 new_cue_mtime = static_cast<qint64>(GetMtimeForCue(new_cue));
|
||||
|
||||
bool cue_added = new_cue_mtime != 0 && !matching_song.has_cue();
|
||||
bool cue_deleted = matching_song_cue_mtime == 0 && matching_song.has_cue();
|
||||
@ -619,7 +619,7 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const Subdirectory
|
||||
}
|
||||
|
||||
// CUE sheet's path from this file (if any).
|
||||
const qint64 new_cue_mtime = GetMtimeForCue(new_cue);
|
||||
const qint64 new_cue_mtime = static_cast<qint64>(GetMtimeForCue(new_cue));
|
||||
|
||||
const bool cue_deleted = new_cue_mtime == 0 && matching_songs_has_cue;
|
||||
const bool cue_added = new_cue_mtime != 0 && !matching_songs_has_cue;
|
||||
|
@ -267,7 +267,7 @@ void ContextAlbumsModel::Reset() {
|
||||
|
||||
CollectionItem *ContextAlbumsModel::ItemFromSong(CollectionItem::Type item_type, const bool signal, CollectionItem *parent, const Song &s, const int container_level) {
|
||||
|
||||
if (signal) beginInsertRows(ItemToIndex(parent), parent->children.count(), parent->children.count());
|
||||
if (signal) beginInsertRows(ItemToIndex(parent), static_cast<int>(parent->children.count()), static_cast<int>(parent->children.count()));
|
||||
|
||||
CollectionItem *item = new CollectionItem(item_type, parent);
|
||||
item->container_level = container_level;
|
||||
|
@ -715,9 +715,9 @@ void ContextView::ResetSong() {
|
||||
|
||||
}
|
||||
|
||||
void ContextView::UpdateLyrics(const quint64 id, const QString &provider, const QString &lyrics) {
|
||||
void ContextView::UpdateLyrics(const int id, const QString &provider, const QString &lyrics) {
|
||||
|
||||
if (static_cast<qint64>(id) != lyrics_id_) return;
|
||||
if (id != lyrics_id_) return;
|
||||
lyrics_ = lyrics + "\n\n(Lyrics from " + provider + ")\n";
|
||||
lyrics_id_ = -1;
|
||||
if (action_show_lyrics_->isChecked()) {
|
||||
|
@ -93,7 +93,7 @@ class ContextView : public QWidget {
|
||||
void ActionSearchLyrics();
|
||||
void UpdateNoSong();
|
||||
void FadeStopFinished();
|
||||
void UpdateLyrics(const quint64 id, const QString &provider, const QString &lyrics);
|
||||
void UpdateLyrics(const int id, const QString &provider, const QString &lyrics);
|
||||
|
||||
public slots:
|
||||
void ReloadSettings();
|
||||
@ -171,7 +171,7 @@ class ContextView : public QWidget {
|
||||
Song song_prev_;
|
||||
QImage image_original_;
|
||||
bool lyrics_tried_;
|
||||
qint64 lyrics_id_;
|
||||
int lyrics_id_;
|
||||
QString lyrics_;
|
||||
QString title_fmt_;
|
||||
QString summary_fmt_;
|
||||
|
@ -108,7 +108,7 @@ void DeleteFiles::ProcessSomeFiles() {
|
||||
|
||||
// We process files in batches so we can be cancelled part-way through.
|
||||
|
||||
const int n = qMin(songs_.count(), progress_ + kBatchSize);
|
||||
const qint64 n = qMin(songs_.count(), static_cast<qint64>(progress_ + kBatchSize));
|
||||
for (; progress_ < n; ++progress_) {
|
||||
task_manager_->SetTaskProgress(task_id_, progress_, songs_.count());
|
||||
|
||||
|
@ -380,7 +380,7 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
|
||||
app_->player()->SetEqualizer(equalizer_.get());
|
||||
app_->player()->Init();
|
||||
EngineChanged(app_->player()->engine()->type());
|
||||
int volume = app_->player()->GetVolume();
|
||||
int volume = static_cast<int>(app_->player()->GetVolume());
|
||||
ui_->volume->setValue(volume);
|
||||
VolumeChanged(volume);
|
||||
|
||||
@ -1375,7 +1375,7 @@ void MainWindow::TrackSkipped(PlaylistItemPtr item) {
|
||||
const qint64 seconds_left = (length - position) / kNsecPerSec;
|
||||
const qint64 seconds_total = length / kNsecPerSec;
|
||||
|
||||
if (((0.05 * seconds_total > 60 && percentage < 0.98) || percentage < 0.95) && seconds_left > 5) { // Never count the skip if under 5 seconds left
|
||||
if (((0.05 * static_cast<double>(seconds_total) > 60.0 && percentage < 0.98) || percentage < 0.95) && seconds_left > 5) { // Never count the skip if under 5 seconds left
|
||||
app_->collection_backend()->IncrementSkipCountAsync(song.id(), percentage);
|
||||
}
|
||||
}
|
||||
@ -1630,7 +1630,7 @@ void MainWindow::Seeked(const qint64 microseconds) {
|
||||
|
||||
const qint64 position = microseconds / kUsecPerSec;
|
||||
const qint64 length = app_->player()->GetCurrentItem()->Metadata().length_nanosec() / kNsecPerSec;
|
||||
tray_icon_->SetProgress(static_cast<int>(static_cast<double>(position) / length * 100));
|
||||
tray_icon_->SetProgress(static_cast<int>(static_cast<double>(position) / static_cast<double>(length) * 100.0));
|
||||
|
||||
}
|
||||
|
||||
@ -1641,10 +1641,10 @@ void MainWindow::UpdateTrackPosition() {
|
||||
|
||||
const qint64 length = (item->Metadata().length_nanosec() / kNsecPerSec);
|
||||
if (length <= 0) return;
|
||||
const int position = std::floor(static_cast<float>(app_->player()->engine()->position_nanosec()) / kNsecPerSec + 0.5);
|
||||
const int position = std::floor(static_cast<float>(app_->player()->engine()->position_nanosec()) / static_cast<float>(kNsecPerSec) + 0.5);
|
||||
|
||||
// Update the tray icon every 10 seconds
|
||||
if (position % 10 == 0) tray_icon_->SetProgress(static_cast<int>(static_cast<double>(position) / length * 100));
|
||||
if (position % 10 == 0) tray_icon_->SetProgress(static_cast<int>(static_cast<double>(position) / static_cast<double>(length) * 100.0));
|
||||
|
||||
// Send Scrobble
|
||||
if (app_->scrobbler()->IsEnabled() && item->Metadata().is_metadata_good()) {
|
||||
@ -1816,7 +1816,7 @@ void MainWindow::PlaylistRightClick(const QPoint global_pos, const QModelIndex &
|
||||
// Are any of the selected songs editable or queued?
|
||||
QModelIndexList selection = ui_->playlist->view()->selectionModel()->selectedRows();
|
||||
bool cue_selected = false;
|
||||
int selected = ui_->playlist->view()->selectionModel()->selectedRows().count();
|
||||
qint64 selected = ui_->playlist->view()->selectionModel()->selectedRows().count();
|
||||
int editable = 0;
|
||||
int in_queue = 0;
|
||||
int not_in_queue = 0;
|
||||
@ -2433,7 +2433,7 @@ void MainWindow::CommandlineOptionsReceived(const CommandlineOptions &options) {
|
||||
if (options.set_volume() != -1) app_->player()->SetVolume(options.set_volume());
|
||||
|
||||
if (options.volume_modifier() != 0) {
|
||||
app_->player()->SetVolume(app_->player()->GetVolume() +options.volume_modifier());
|
||||
app_->player()->SetVolume(app_->player()->GetVolume() + options.volume_modifier());
|
||||
}
|
||||
|
||||
if (options.seek_to() != -1) {
|
||||
@ -3183,8 +3183,8 @@ void MainWindow::FocusSearchField() {
|
||||
qobuz_view_->FocusSearchField();
|
||||
}
|
||||
#endif
|
||||
else if (!ui_->playlist->SearchFieldHasFocus()) {
|
||||
ui_->playlist->FocusSearchField();
|
||||
}
|
||||
else if (!ui_->playlist->SearchFieldHasFocus()) {
|
||||
ui_->playlist->FocusSearchField();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -632,11 +632,11 @@ void Player::EngineStateChanged(const Engine::State state) {
|
||||
|
||||
}
|
||||
|
||||
void Player::SetVolume(const int value) {
|
||||
void Player::SetVolume(const uint value) {
|
||||
|
||||
int old_volume = engine_->volume();
|
||||
uint old_volume = engine_->volume();
|
||||
|
||||
int volume = qBound(0, value, 100);
|
||||
uint volume = qBound(0U, value, 100U);
|
||||
settings_.setValue("volume", volume);
|
||||
engine_->SetVolume(volume);
|
||||
|
||||
@ -646,9 +646,9 @@ void Player::SetVolume(const int value) {
|
||||
|
||||
}
|
||||
|
||||
int Player::GetVolume() const { return engine_->volume(); }
|
||||
uint Player::GetVolume() const { return engine_->volume(); }
|
||||
|
||||
void Player::PlayAt(const int index, const qint64 offset_nanosec, Engine::TrackChangeFlags change, const Playlist::AutoScroll autoscroll, const bool reshuffle, const bool force_inform) {
|
||||
void Player::PlayAt(const int index, const quint64 offset_nanosec, Engine::TrackChangeFlags change, const Playlist::AutoScroll autoscroll, const bool reshuffle, const bool force_inform) {
|
||||
|
||||
pause_time_ = QDateTime();
|
||||
play_offset_nanosec_ = offset_nanosec;
|
||||
@ -696,7 +696,7 @@ void Player::CurrentMetadataChanged(const Song &metadata) {
|
||||
|
||||
}
|
||||
|
||||
void Player::SeekTo(const qint64 seconds) {
|
||||
void Player::SeekTo(const quint64 seconds) {
|
||||
|
||||
const qint64 length_nanosec = engine_->length_nanosec();
|
||||
|
||||
@ -705,7 +705,7 @@ void Player::SeekTo(const qint64 seconds) {
|
||||
return;
|
||||
}
|
||||
|
||||
const qint64 nanosec = qBound(0LL, seconds * kNsecPerSec, length_nanosec);
|
||||
const qint64 nanosec = qBound(0LL, static_cast<qint64>(seconds) * kNsecPerSec, length_nanosec);
|
||||
engine_->Seek(nanosec);
|
||||
|
||||
qLog(Debug) << "Track seeked to" << nanosec << "ns - updating scrobble point";
|
||||
@ -766,7 +766,7 @@ void Player::Mute() {
|
||||
|
||||
if (!volume_control_) return;
|
||||
|
||||
const int current_volume = engine_->volume();
|
||||
const uint current_volume = engine_->volume();
|
||||
|
||||
if (current_volume == 0) {
|
||||
SetVolume(volume_before_mute_);
|
||||
|
@ -61,7 +61,7 @@ class PlayerInterface : public QObject {
|
||||
|
||||
virtual EngineBase *engine() const = 0;
|
||||
virtual Engine::State GetState() const = 0;
|
||||
virtual int GetVolume() const = 0;
|
||||
virtual uint GetVolume() const = 0;
|
||||
|
||||
virtual PlaylistItemPtr GetCurrentItem() const = 0;
|
||||
virtual PlaylistItemPtr GetItemAt(const int pos) const = 0;
|
||||
@ -73,7 +73,7 @@ class PlayerInterface : public QObject {
|
||||
virtual void ReloadSettings() = 0;
|
||||
|
||||
// Manual track change to the specified track
|
||||
virtual void PlayAt(const int index, const qint64 offset_nanosec, Engine::TrackChangeFlags change, const Playlist::AutoScroll autoscroll, const bool reshuffle, const bool force_inform = false) = 0;
|
||||
virtual void PlayAt(const int index, const quint64 offset_nanosec, Engine::TrackChangeFlags change, const Playlist::AutoScroll autoscroll, const bool reshuffle, const bool force_inform = false) = 0;
|
||||
|
||||
// If there's currently a song playing, pause it, otherwise play the track that was playing last, or the first one on the playlist
|
||||
virtual void PlayPause(const quint64 offset_nanosec = 0, const Playlist::AutoScroll autoscroll = Playlist::AutoScroll_Always) = 0;
|
||||
@ -84,10 +84,10 @@ class PlayerInterface : public QObject {
|
||||
virtual void Next() = 0;
|
||||
virtual void Previous() = 0;
|
||||
virtual void PlayPlaylist(const QString &playlist_name) = 0;
|
||||
virtual void SetVolume(const int value) = 0;
|
||||
virtual void SetVolume(const uint value) = 0;
|
||||
virtual void VolumeUp() = 0;
|
||||
virtual void VolumeDown() = 0;
|
||||
virtual void SeekTo(const qint64 seconds) = 0;
|
||||
virtual void SeekTo(const quint64 seconds) = 0;
|
||||
// Moves the position of the currently playing song five seconds forward.
|
||||
virtual void SeekForward() = 0;
|
||||
// Moves the position of the currently playing song five seconds backwards.
|
||||
@ -111,7 +111,7 @@ class PlayerInterface : public QObject {
|
||||
void Error(QString message = QString());
|
||||
void PlaylistFinished();
|
||||
void VolumeEnabled(bool);
|
||||
void VolumeChanged(int volume);
|
||||
void VolumeChanged(uint volume);
|
||||
void TrackSkipped(PlaylistItemPtr old_track);
|
||||
// Emitted when there's a manual change to the current's track position.
|
||||
void Seeked(qint64 microseconds);
|
||||
@ -141,7 +141,7 @@ class Player : public PlayerInterface {
|
||||
|
||||
EngineBase *engine() const override { return engine_.get(); }
|
||||
Engine::State GetState() const override { return last_state_; }
|
||||
int GetVolume() const override;
|
||||
uint GetVolume() const override;
|
||||
|
||||
PlaylistItemPtr GetCurrentItem() const override { return current_item_; }
|
||||
PlaylistItemPtr GetItemAt(const int pos) const override;
|
||||
@ -159,17 +159,17 @@ class Player : public PlayerInterface {
|
||||
public slots:
|
||||
void ReloadSettings() override;
|
||||
|
||||
void PlayAt(const int index, const qint64 offset_nanosec, Engine::TrackChangeFlags change, const Playlist::AutoScroll autoscroll, const bool reshuffle, const bool force_inform = false) override;
|
||||
void PlayAt(const int index, const quint64 offset_nanosec, Engine::TrackChangeFlags change, const Playlist::AutoScroll autoscroll, const bool reshuffle, const bool force_inform = false) override;
|
||||
void PlayPause(const quint64 offset_nanosec = 0, const Playlist::AutoScroll autoscroll = Playlist::AutoScroll_Always) override;
|
||||
void PlayPauseHelper() override { PlayPause(play_offset_nanosec_); }
|
||||
void RestartOrPrevious() override;
|
||||
void Next() override;
|
||||
void Previous() override;
|
||||
void PlayPlaylist(const QString &playlist_name) override;
|
||||
void SetVolume(const int value) override;
|
||||
void SetVolume(const uint value) override;
|
||||
void VolumeUp() override { SetVolume(GetVolume() + 5); }
|
||||
void VolumeDown() override { SetVolume(GetVolume() - 5); }
|
||||
void SeekTo(const qint64 seconds) override;
|
||||
void SeekTo(const quint64 seconds) override;
|
||||
void SeekForward() override;
|
||||
void SeekBackward() override;
|
||||
|
||||
@ -235,7 +235,7 @@ class Player : public PlayerInterface {
|
||||
QMap<QString, UrlHandler*> url_handlers_;
|
||||
|
||||
QList<QUrl> loading_async_;
|
||||
int volume_before_mute_;
|
||||
uint volume_before_mute_;
|
||||
QDateTime last_pressed_previous_;
|
||||
|
||||
bool continue_on_error_;
|
||||
|
@ -202,7 +202,7 @@ struct Song::Private : public QSharedData {
|
||||
QString basefilename_;
|
||||
QUrl url_;
|
||||
FileType filetype_;
|
||||
int filesize_;
|
||||
qint64 filesize_;
|
||||
qint64 mtime_;
|
||||
qint64 ctime_;
|
||||
bool unavailable_;
|
||||
@ -331,7 +331,7 @@ int Song::directory_id() const { return d->directory_id_; }
|
||||
const QUrl &Song::url() const { return d->url_; }
|
||||
const QString &Song::basefilename() const { return d->basefilename_; }
|
||||
Song::FileType Song::filetype() const { return d->filetype_; }
|
||||
int Song::filesize() const { return d->filesize_; }
|
||||
qint64 Song::filesize() const { return d->filesize_; }
|
||||
qint64 Song::mtime() const { return d->mtime_; }
|
||||
qint64 Song::ctime() const { return d->ctime_; }
|
||||
|
||||
@ -421,7 +421,7 @@ QString Song::sortable(const QString &v) {
|
||||
|
||||
for (const auto &i : kArticles) {
|
||||
if (copy.startsWith(i)) {
|
||||
int ilen = i.length();
|
||||
qint64 ilen = i.length();
|
||||
return copy.right(copy.length() - ilen) + ", " + copy.left(ilen - 1);
|
||||
}
|
||||
}
|
||||
@ -458,7 +458,7 @@ void Song::set_directory_id(int v) { d->directory_id_ = v; }
|
||||
void Song::set_url(const QUrl &v) { d->url_ = v; }
|
||||
void Song::set_basefilename(const QString &v) { d->basefilename_ = v; }
|
||||
void Song::set_filetype(FileType v) { d->filetype_ = v; }
|
||||
void Song::set_filesize(int v) { d->filesize_ = v; }
|
||||
void Song::set_filesize(qint64 v) { d->filesize_ = v; }
|
||||
void Song::set_mtime(qint64 v) { d->mtime_ = v; }
|
||||
void Song::set_ctime(qint64 v) { d->ctime_ = v; }
|
||||
void Song::set_unavailable(bool v) { d->unavailable_ = v; }
|
||||
@ -846,11 +846,11 @@ void Song::InitFromProtobuf(const spb::tagreader::SongMetadata &pb) {
|
||||
d->grouping_ = QStringFromStdString(pb.grouping());
|
||||
d->comment_ = QStringFromStdString(pb.comment());
|
||||
d->lyrics_ = QStringFromStdString(pb.lyrics());
|
||||
set_length_nanosec(pb.length_nanosec());
|
||||
set_length_nanosec(static_cast<qint64>(pb.length_nanosec()));
|
||||
d->bitrate_ = pb.bitrate();
|
||||
d->samplerate_ = pb.samplerate();
|
||||
d->bitdepth_ = pb.bitdepth();
|
||||
set_url(QUrl::fromEncoded(QByteArray(pb.url().data(), pb.url().size())));
|
||||
set_url(QUrl::fromEncoded(QByteArray(pb.url().data(), static_cast<qint64>(pb.url().size()))));
|
||||
d->basefilename_ = QStringFromStdString(pb.basefilename());
|
||||
d->filetype_ = static_cast<FileType>(pb.filetype());
|
||||
d->filesize_ = pb.filesize();
|
||||
@ -868,7 +868,7 @@ void Song::InitFromProtobuf(const spb::tagreader::SongMetadata &pb) {
|
||||
}
|
||||
|
||||
if (pb.has_art_automatic()) {
|
||||
QByteArray art_automatic(pb.art_automatic().data(), pb.art_automatic().size());
|
||||
QByteArray art_automatic(pb.art_automatic().data(), static_cast<qint64>(pb.art_automatic().size()));
|
||||
if (!art_automatic.isEmpty()) set_art_automatic(QUrl::fromLocalFile(art_automatic));
|
||||
}
|
||||
|
||||
@ -1028,7 +1028,7 @@ void Song::InitFromQuery(const SqlRow &q, bool reliable_metadata, int col) {
|
||||
d->filetype_ = FileType(q.value(x).toInt());
|
||||
}
|
||||
else if (Song::kColumns.value(i) == "filesize") {
|
||||
d->filesize_ = toint(x);
|
||||
d->filesize_ = tolonglong(x);
|
||||
}
|
||||
else if (Song::kColumns.value(i) == "mtime") {
|
||||
d->mtime_ = tolonglong(x);
|
||||
@ -1200,8 +1200,8 @@ void Song::InitFromItdb(Itdb_Track *track, const QString &prefix) {
|
||||
d->mtime_ = track->time_modified;
|
||||
d->ctime_ = track->time_added;
|
||||
|
||||
d->playcount_ = track->playcount;
|
||||
d->skipcount_ = track->skipcount;
|
||||
d->playcount_ = static_cast<int>(track->playcount);
|
||||
d->skipcount_ = static_cast<int>(track->skipcount);
|
||||
d->lastplayed_ = track->time_played;
|
||||
|
||||
if (itdb_track_has_thumbnails(track) && !d->artist_.isEmpty() && !d->title_.isEmpty()) {
|
||||
@ -1236,7 +1236,7 @@ void Song::ToItdb(Itdb_Track *track) const {
|
||||
track->grouping = strdup(d->grouping_.toUtf8().constData());
|
||||
track->comment = strdup(d->comment_.toUtf8().constData());
|
||||
|
||||
track->tracklen = length_nanosec() / kNsecPerMsec;
|
||||
track->tracklen = static_cast<int>(length_nanosec() / kNsecPerMsec);
|
||||
|
||||
track->bitrate = d->bitrate_;
|
||||
track->samplerate = d->samplerate_;
|
||||
@ -1244,7 +1244,7 @@ void Song::ToItdb(Itdb_Track *track) const {
|
||||
track->type1 = (d->filetype_ == FileType_MPEG ? 1 : 0);
|
||||
track->type2 = (d->filetype_ == FileType_MPEG ? 1 : 0);
|
||||
track->mediatype = 1; // Audio
|
||||
track->size = d->filesize_;
|
||||
track->size = static_cast<uint>(d->filesize_);
|
||||
track->time_modified = d->mtime_;
|
||||
track->time_added = d->ctime_;
|
||||
|
||||
@ -1270,17 +1270,17 @@ void Song::InitFromMTP(const LIBMTP_track_t *track, const QString &host) {
|
||||
|
||||
d->url_ = QUrl(QString("mtp://%1/%2").arg(host, QString::number(track->item_id)));
|
||||
d->basefilename_ = QString::number(track->item_id);
|
||||
d->filesize_ = track->filesize;
|
||||
d->filesize_ = static_cast<qint64>(track->filesize);
|
||||
d->mtime_ = track->modificationdate;
|
||||
d->ctime_ = track->modificationdate;
|
||||
|
||||
set_length_nanosec(track->duration * kNsecPerMsec);
|
||||
|
||||
d->samplerate_ = track->samplerate;
|
||||
d->samplerate_ = static_cast<int>(track->samplerate);
|
||||
d->bitdepth_ = 0;
|
||||
d->bitrate_ = track->bitrate;
|
||||
d->bitrate_ = static_cast<int>(track->bitrate);
|
||||
|
||||
d->playcount_ = track->usecount;
|
||||
d->playcount_ = static_cast<int>(track->usecount);
|
||||
|
||||
switch (track->filetype) {
|
||||
case LIBMTP_FILETYPE_WAV: d->filetype_ = FileType_WAV; break;
|
||||
@ -1319,7 +1319,7 @@ void Song::ToMTP(LIBMTP_track_t *track) const {
|
||||
|
||||
track->filename = strdup(d->basefilename_.toUtf8().constData());
|
||||
|
||||
track->filesize = d->filesize_;
|
||||
track->filesize = static_cast<quint64>(d->filesize_);
|
||||
track->modificationdate = d->mtime_;
|
||||
|
||||
track->duration = length_nanosec() / kNsecPerMsec;
|
||||
|
@ -237,7 +237,7 @@ class Song {
|
||||
const QUrl &url() const;
|
||||
const QString &basefilename() const;
|
||||
FileType filetype() const;
|
||||
int filesize() const;
|
||||
qint64 filesize() const;
|
||||
qint64 mtime() const;
|
||||
qint64 ctime() const;
|
||||
|
||||
@ -354,7 +354,7 @@ class Song {
|
||||
void set_url(const QUrl &v);
|
||||
void set_basefilename(const QString &v);
|
||||
void set_filetype(FileType v);
|
||||
void set_filesize(int v);
|
||||
void set_filesize(qint64 v);
|
||||
void set_mtime(qint64 v);
|
||||
void set_ctime(qint64 v);
|
||||
void set_unavailable(bool v);
|
||||
|
@ -552,7 +552,7 @@ GstPadProbeReturn SongLoader::DataReady(GstPad*, GstPadProbeInfo *info, gpointer
|
||||
gst_buffer_map(buffer, &map, GST_MAP_READ);
|
||||
|
||||
// Append the data to the buffer
|
||||
instance->buffer_.append(reinterpret_cast<const char*>(map.data), map.size);
|
||||
instance->buffer_.append(reinterpret_cast<const char*>(map.data), static_cast<qint64>(map.size));
|
||||
qLog(Debug) << "Received total" << instance->buffer_.size() << "bytes";
|
||||
gst_buffer_unmap(buffer, &map);
|
||||
|
||||
|
@ -91,7 +91,7 @@ QColor StyleHelper::notTooBrightHighlightColor() {
|
||||
|
||||
QColor highlightColor = QApplication::palette().highlight().color();
|
||||
if (0.5 * highlightColor.saturationF() + 0.75 - highlightColor.valueF() < 0) {
|
||||
highlightColor.setHsvF(highlightColor.hsvHueF(), 0.1 + highlightColor.saturationF() * 2.0, highlightColor.valueF());
|
||||
highlightColor.setHsvF(highlightColor.hsvHueF(), 0.1F + highlightColor.saturationF() * 2.0F, highlightColor.valueF());
|
||||
}
|
||||
return highlightColor;
|
||||
|
||||
@ -133,10 +133,10 @@ QColor StyleHelper::highlightColor(bool lightColored) {
|
||||
|
||||
QColor result = baseColor(lightColored);
|
||||
if (lightColored) {
|
||||
result.setHsv(result.hue(), clamp(result.saturation()), clamp(result.value() * 1.06));
|
||||
result.setHsv(result.hue(), clamp(static_cast<float>(result.saturation())), clamp(static_cast<float>(result.value()) * 1.06F));
|
||||
}
|
||||
else {
|
||||
result.setHsv(result.hue(), clamp(result.saturation()), clamp(result.value() * 1.16));
|
||||
result.setHsv(result.hue(), clamp(static_cast<float>(result.saturation())), clamp(static_cast<float>(result.value()) * 1.16F));
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -146,7 +146,7 @@ QColor StyleHelper::highlightColor(bool lightColored) {
|
||||
QColor StyleHelper::shadowColor(bool lightColored) {
|
||||
|
||||
QColor result = baseColor(lightColored);
|
||||
result.setHsv(result.hue(), clamp(result.saturation() * 1.1), clamp(result.value() * 0.70));
|
||||
result.setHsv(result.hue(), clamp(static_cast<float>(result.saturation()) * 1.1F), clamp(static_cast<float>(result.value()) * 0.70F));
|
||||
return result;
|
||||
|
||||
}
|
||||
@ -162,7 +162,7 @@ QColor StyleHelper::borderColor(bool lightColored) {
|
||||
QColor StyleHelper::toolBarBorderColor() {
|
||||
|
||||
const QColor base = baseColor();
|
||||
return QColor::fromHsv(base.hue(), base.saturation(), clamp(base.value() * 0.80F));
|
||||
return QColor::fromHsv(base.hue(), base.saturation(), clamp(static_cast<float>(base.value()) * 0.80F));
|
||||
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ void StyleHelper::setBaseColor(const QColor &newcolor) {
|
||||
m_requestedBaseColor = newcolor;
|
||||
|
||||
QColor color;
|
||||
color.setHsv(newcolor.hue(), newcolor.saturation() * 0.7, 64 + newcolor.value() / 3);
|
||||
color.setHsv(newcolor.hue(), static_cast<int>(static_cast<float>(newcolor.saturation()) * 0.7F), 64 + newcolor.value() / 3);
|
||||
|
||||
if (color.isValid() && color != m_baseColor) {
|
||||
m_baseColor = color;
|
||||
@ -303,7 +303,7 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter,
|
||||
QPixmap pixmap;
|
||||
QString pixmapName = QString::asprintf("StyleHelper::drawArrow-%d-%d-%d-%f", element, size, (enabled ? 1 : 0), devicePixelRatio);
|
||||
if (!QPixmapCache::find(pixmapName, &pixmap)) {
|
||||
QImage image(size * devicePixelRatio, size * devicePixelRatio, QImage::Format_ARGB32_Premultiplied);
|
||||
QImage image(size * static_cast<int>(devicePixelRatio), size * static_cast<int>(devicePixelRatio), QImage::Format_ARGB32_Premultiplied);
|
||||
image.fill(Qt::transparent);
|
||||
QPainter p(&image);
|
||||
|
||||
@ -325,7 +325,7 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter,
|
||||
drawCommonStyleArrow(image.rect(), m_IconsDisabledColor);
|
||||
}
|
||||
else {
|
||||
drawCommonStyleArrow(image.rect().translated(0, devicePixelRatio), toolBarDropShadowColor());
|
||||
drawCommonStyleArrow(image.rect().translated(0, static_cast<int>(devicePixelRatio)), toolBarDropShadowColor());
|
||||
drawCommonStyleArrow(image.rect(), m_IconsBaseColor);
|
||||
}
|
||||
p.end();
|
||||
@ -434,7 +434,7 @@ void StyleHelper::tintImage(QImage &img, const QColor &tintColor) {
|
||||
|
||||
if (alpha > 0) {
|
||||
c.toHsl();
|
||||
qreal l = c.lightnessF();
|
||||
float l = c.lightnessF();
|
||||
QColor newColor = QColor::fromHslF(tintColor.hslHueF(), tintColor.hslSaturationF(), l);
|
||||
newColor.setAlpha(alpha);
|
||||
img.setPixel(x, y, newColor.rgba());
|
||||
|
@ -223,7 +223,7 @@ QByteArray TagReaderClient::LoadEmbeddedArtBlocking(const QString &filename) {
|
||||
TagReaderReply *reply = LoadEmbeddedArt(filename);
|
||||
if (reply->WaitForFinished()) {
|
||||
const std::string &data_str = reply->message().load_embedded_art_response().data();
|
||||
ret = QByteArray(data_str.data(), data_str.size());
|
||||
ret = QByteArray(data_str.data(), static_cast<qint64>(data_str.size()));
|
||||
}
|
||||
QMetaObject::invokeMethod(reply, "deleteLater", Qt::QueuedConnection);
|
||||
|
||||
@ -240,7 +240,7 @@ QImage TagReaderClient::LoadEmbeddedArtAsImageBlocking(const QString &filename)
|
||||
TagReaderReply *reply = LoadEmbeddedArt(filename);
|
||||
if (reply->WaitForFinished()) {
|
||||
const std::string &data_str = reply->message().load_embedded_art_response().data();
|
||||
ret.loadFromData(QByteArray(data_str.data(), data_str.size()));
|
||||
ret.loadFromData(QByteArray(data_str.data(), static_cast<qint64>(data_str.size())));
|
||||
}
|
||||
QMetaObject::invokeMethod(reply, "deleteLater", Qt::QueuedConnection);
|
||||
|
||||
|
@ -79,7 +79,7 @@ void TaskManager::SetTaskBlocksCollectionScans(const int id) {
|
||||
|
||||
}
|
||||
|
||||
void TaskManager::SetTaskProgress(const int id, const qint64 progress, const qint64 max) {
|
||||
void TaskManager::SetTaskProgress(const int id, const quint64 progress, const quint64 max) {
|
||||
|
||||
{
|
||||
QMutexLocker l(&mutex_);
|
||||
@ -93,7 +93,7 @@ void TaskManager::SetTaskProgress(const int id, const qint64 progress, const qin
|
||||
emit TasksChanged();
|
||||
}
|
||||
|
||||
void TaskManager::IncreaseTaskProgress(const int id, const qint64 progress, const qint64 max) {
|
||||
void TaskManager::IncreaseTaskProgress(const int id, const quint64 progress, const quint64 max) {
|
||||
|
||||
{
|
||||
QMutexLocker l(&mutex_);
|
||||
@ -134,7 +134,7 @@ void TaskManager::SetTaskFinished(const int id) {
|
||||
|
||||
}
|
||||
|
||||
int TaskManager::GetTaskProgress(int id) {
|
||||
quint64 TaskManager::GetTaskProgress(int id) {
|
||||
|
||||
{
|
||||
QMutexLocker l(&mutex_);
|
||||
|
@ -41,8 +41,8 @@ class TaskManager : public QObject {
|
||||
Task() : id(0), progress(0), progress_max(0), blocks_collection_scans(false) {}
|
||||
int id;
|
||||
QString name;
|
||||
qint64 progress;
|
||||
qint64 progress_max;
|
||||
quint64 progress;
|
||||
quint64 progress_max;
|
||||
bool blocks_collection_scans;
|
||||
};
|
||||
|
||||
@ -64,10 +64,10 @@ class TaskManager : public QObject {
|
||||
|
||||
int StartTask(const QString &name);
|
||||
void SetTaskBlocksCollectionScans(const int id);
|
||||
void SetTaskProgress(const int id, const qint64 progress, const qint64 max = 0);
|
||||
void IncreaseTaskProgress(const int id, const qint64 progress, const qint64 max = 0);
|
||||
void SetTaskProgress(const int id, const quint64 progress, const quint64 max = 0);
|
||||
void IncreaseTaskProgress(const int id, const quint64 progress, const quint64 max = 0);
|
||||
void SetTaskFinished(const int id);
|
||||
int GetTaskProgress(const int id);
|
||||
quint64 GetTaskProgress(const int id);
|
||||
|
||||
signals:
|
||||
void TasksChanged();
|
||||
|
@ -191,13 +191,13 @@ QString PrettySize(const quint64 bytes) {
|
||||
ret = QString::number(bytes) + " bytes";
|
||||
}
|
||||
else if (bytes <= 1000 * 1000) {
|
||||
ret = QString::asprintf("%.1f KB", static_cast<float>(bytes) / 1000);
|
||||
ret = QString::asprintf("%.1f KB", static_cast<float>(bytes) / 1000.0F);
|
||||
}
|
||||
else if (bytes <= 1000 * 1000 * 1000) {
|
||||
ret = QString::asprintf("%.1f MB", static_cast<float>(bytes) / (1000 * 1000));
|
||||
ret = QString::asprintf("%.1f MB", static_cast<float>(bytes) / (1000.0F * 1000.0F));
|
||||
}
|
||||
else {
|
||||
ret = QString::asprintf("%.1f GB", static_cast<float>(bytes) / (1000 * 1000 * 1000));
|
||||
ret = QString::asprintf("%.1f GB", static_cast<float>(bytes) / (1000.0F * 1000.0F * 1000.0F));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@ -746,7 +746,7 @@ QString GetRandomString(const int len, const QString &UseCharacters) {
|
||||
QString randstr;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
const int index = QRandomGenerator::global()->bounded(0, UseCharacters.length());
|
||||
const qint64 index = QRandomGenerator::global()->bounded(0, UseCharacters.length());
|
||||
#else
|
||||
const int index = qrand() % UseCharacters.length();
|
||||
#endif
|
||||
@ -767,7 +767,7 @@ QString DesktopEnvironment() {
|
||||
if (!qEnvironmentVariableIsEmpty("GNOME_DESKTOP_SESSION_ID")) return "Gnome";
|
||||
|
||||
QString session = GetEnv("DESKTOP_SESSION");
|
||||
int slash = session.lastIndexOf('/');
|
||||
qint64 slash = session.lastIndexOf('/');
|
||||
if (slash != -1) {
|
||||
QSettings desktop_file(QString(session + ".desktop"), QSettings::IniFormat);
|
||||
desktop_file.beginGroup("Desktop Entry");
|
||||
@ -864,7 +864,7 @@ QString ReplaceMessage(const QString &message, const Song &song, const QString &
|
||||
QString copy(message);
|
||||
|
||||
// Replace the first line
|
||||
int pos = 0;
|
||||
qint64 pos = 0;
|
||||
QRegularExpressionMatch match;
|
||||
for (match = variable_replacer.match(message, pos); match.hasMatch(); match = variable_replacer.match(message, pos)) {
|
||||
pos = match.capturedStart();
|
||||
@ -873,7 +873,7 @@ QString ReplaceMessage(const QString &message, const Song &song, const QString &
|
||||
pos += match.capturedLength();
|
||||
}
|
||||
|
||||
int index_of = copy.indexOf(QRegularExpression(" - (>|$)"));
|
||||
qint64 index_of = copy.indexOf(QRegularExpression(" - (>|$)"));
|
||||
if (index_of >= 0) copy = copy.remove(index_of, 3);
|
||||
|
||||
return copy;
|
||||
@ -1039,4 +1039,3 @@ ScopedWCharArray::ScopedWCharArray(const QString &str)
|
||||
str.toWCharArray(data_.get());
|
||||
data_[chars_] = '\0';
|
||||
}
|
||||
|
||||
|
@ -159,13 +159,13 @@ class ScopedWCharArray {
|
||||
wchar_t *get() const { return data_.get(); }
|
||||
explicit operator wchar_t*() const { return get(); }
|
||||
|
||||
int characters() const { return chars_; }
|
||||
int bytes() const { return (chars_ + 1) *sizeof(wchar_t); }
|
||||
qint64 characters() const { return chars_; }
|
||||
qint64 bytes() const { return (chars_ + 1) *sizeof(wchar_t); }
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(ScopedWCharArray)
|
||||
|
||||
int chars_;
|
||||
qint64 chars_;
|
||||
std::unique_ptr<wchar_t[]> data_;
|
||||
};
|
||||
|
||||
|
@ -45,15 +45,17 @@ void AlbumCoverExporter::SetDialogResult(const AlbumCoverExport::DialogResult &d
|
||||
|
||||
void AlbumCoverExporter::AddExportRequest(const Song &song) {
|
||||
requests_.append(new CoverExportRunnable(dialog_result_, song));
|
||||
all_ = requests_.count();
|
||||
all_ = static_cast<int>(requests_.count());
|
||||
}
|
||||
|
||||
void AlbumCoverExporter::Cancel() { requests_.clear(); }
|
||||
|
||||
void AlbumCoverExporter::StartExporting() {
|
||||
|
||||
exported_ = 0;
|
||||
skipped_ = 0;
|
||||
AddJobsToPool();
|
||||
|
||||
}
|
||||
|
||||
void AlbumCoverExporter::AddJobsToPool() {
|
||||
@ -70,13 +72,17 @@ void AlbumCoverExporter::AddJobsToPool() {
|
||||
}
|
||||
|
||||
void AlbumCoverExporter::CoverExported() {
|
||||
exported_++;
|
||||
|
||||
++exported_;
|
||||
emit AlbumCoversExportUpdate(exported_, skipped_, all_);
|
||||
AddJobsToPool();
|
||||
|
||||
}
|
||||
|
||||
void AlbumCoverExporter::CoverSkipped() {
|
||||
skipped_++;
|
||||
|
||||
++skipped_;
|
||||
emit AlbumCoversExportUpdate(exported_, skipped_, all_);
|
||||
AddJobsToPool();
|
||||
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class AlbumCoverExporter : public QObject {
|
||||
void StartExporting();
|
||||
void Cancel();
|
||||
|
||||
int request_count() { return requests_.size(); }
|
||||
int request_count() { return static_cast<int>(requests_.size()); }
|
||||
|
||||
signals:
|
||||
void AlbumCoversExportUpdate(int exported, int skipped, int all);
|
||||
|
@ -229,7 +229,7 @@ QByteArray DiscogsCoverProvider::GetReplyData(QNetworkReply *reply) {
|
||||
|
||||
}
|
||||
|
||||
void DiscogsCoverProvider::HandleSearchReply(QNetworkReply *reply, const quint64 id) {
|
||||
void DiscogsCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id) {
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
@ -336,7 +336,7 @@ void DiscogsCoverProvider::SendReleaseRequest(const DiscogsCoverReleaseContext &
|
||||
|
||||
}
|
||||
|
||||
void DiscogsCoverProvider::HandleReleaseReply(QNetworkReply *reply, const quint64 search_id, const quint64 release_id) {
|
||||
void DiscogsCoverProvider::HandleReleaseReply(QNetworkReply *reply, const int search_id, const quint64 release_id) {
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
|
@ -62,7 +62,7 @@ class DiscogsCoverProvider : public JsonCoverProvider {
|
||||
|
||||
struct DiscogsCoverReleaseContext {
|
||||
explicit DiscogsCoverReleaseContext(const quint64 _search_id = 0, const quint64 _id = 0, const QUrl &_url = QUrl()) : search_id(_search_id), id(_id), url(_url) {}
|
||||
quint64 search_id;
|
||||
int search_id;
|
||||
quint64 id;
|
||||
QUrl url;
|
||||
};
|
||||
@ -90,8 +90,8 @@ class DiscogsCoverProvider : public JsonCoverProvider {
|
||||
|
||||
private slots:
|
||||
void FlushRequests();
|
||||
void HandleSearchReply(QNetworkReply *reply, const quint64 id);
|
||||
void HandleReleaseReply(QNetworkReply *reply, const quint64 id, const quint64 release_id);
|
||||
void HandleSearchReply(QNetworkReply *reply, const int id);
|
||||
void HandleReleaseReply(QNetworkReply *reply, const int search_id, const quint64 release_id);
|
||||
|
||||
private:
|
||||
static const char *kUrlSearch;
|
||||
|
@ -127,11 +127,11 @@ void MusixmatchCoverProvider::HandleSearchReply(QNetworkReply *reply, const int
|
||||
QString content = data;
|
||||
QString data_begin = "var __mxmState = ";
|
||||
QString data_end = ";</script>";
|
||||
int begin_idx = content.indexOf(data_begin);
|
||||
qint64 begin_idx = content.indexOf(data_begin);
|
||||
QString content_json;
|
||||
if (begin_idx > 0) {
|
||||
begin_idx += data_begin.length();
|
||||
int end_idx = content.indexOf(data_end, begin_idx);
|
||||
qint64 end_idx = content.indexOf(data_end, begin_idx);
|
||||
if (end_idx > begin_idx) {
|
||||
content_json = content.mid(begin_idx, end_idx - begin_idx);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ SpotifyCoverProvider::SpotifyCoverProvider(Application *app, NetworkAccessManage
|
||||
s.endGroup();
|
||||
|
||||
if (!refresh_token_.isEmpty()) {
|
||||
qint64 time = expires_in_ - (QDateTime::currentDateTime().toSecsSinceEpoch() - login_time_);
|
||||
qint64 time = static_cast<qint64>(expires_in_) - (QDateTime::currentDateTime().toSecsSinceEpoch() - static_cast<qint64>(login_time_));
|
||||
if (time < 1) time = 1;
|
||||
refresh_login_timer_.setInterval(static_cast<int>(time * kMsecPerSec));
|
||||
refresh_login_timer_.start();
|
||||
|
@ -175,7 +175,7 @@ void CddaSongLoader::LoadSongs() {
|
||||
int i = 0;
|
||||
for (GList *node = entries; node != nullptr; node = node->next) {
|
||||
GstTocEntry *entry = static_cast<GstTocEntry*>(node->data);
|
||||
quint64 duration = 0;
|
||||
qint64 duration = 0;
|
||||
gint64 start = 0, stop = 0;
|
||||
if (gst_toc_entry_get_start_stop_times(entry, &start, &stop)) duration = stop - start;
|
||||
songs[i++].set_length_nanosec(duration);
|
||||
|
@ -61,7 +61,7 @@ class ConnectedDevice : public QObject, public virtual MusicStorage, public std:
|
||||
QString unique_id() const { return unique_id_; }
|
||||
CollectionModel *model() const { return model_; }
|
||||
QUrl url() const { return url_; }
|
||||
int song_count() const { return song_count_; }
|
||||
qint64 song_count() const { return song_count_; }
|
||||
|
||||
void FinishCopy(bool success) override;
|
||||
void FinishDelete(bool success) override;
|
||||
@ -94,7 +94,7 @@ class ConnectedDevice : public QObject, public virtual MusicStorage, public std:
|
||||
CollectionBackend *backend_;
|
||||
CollectionModel *model_;
|
||||
|
||||
int song_count_;
|
||||
qint64 song_count_;
|
||||
|
||||
private slots:
|
||||
void BackendTotalSongCountUpdated(int count);
|
||||
|
@ -265,7 +265,7 @@ void DeviceManager::AddDeviceFromDB(DeviceInfo *info) {
|
||||
}
|
||||
else {
|
||||
qLog(Info) << "Device added from database: " << info->friendly_name_;
|
||||
beginInsertRows(ItemToIndex(root_), devices_.count(), devices_.count());
|
||||
beginInsertRows(ItemToIndex(root_), static_cast<int>(devices_.count()), static_cast<int>(devices_.count()));
|
||||
devices_ << info;
|
||||
endInsertRows();
|
||||
}
|
||||
@ -485,7 +485,7 @@ void DeviceManager::PhysicalDeviceAdded(const QString &id) {
|
||||
info->friendly_name_ = lister->MakeFriendlyName(id);
|
||||
info->size_ = lister->DeviceCapacity(id);
|
||||
info->LoadIcon(lister->DeviceIcons(id), info->friendly_name_);
|
||||
beginInsertRows(ItemToIndex(root_), devices_.count(), devices_.count());
|
||||
beginInsertRows(ItemToIndex(root_), static_cast<int>(devices_.count()), static_cast<int>(devices_.count()));
|
||||
devices_ << info;
|
||||
endInsertRows();
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ bool MtpDevice::StartCopy(QList<Song::FileType> *supported_types) {
|
||||
static int ProgressCallback(uint64_t const sent, uint64_t const total, void const *const data) {
|
||||
|
||||
const MusicStorage::CopyJob *job = reinterpret_cast<const MusicStorage::CopyJob*>(data);
|
||||
job->progress_(static_cast<float>(sent) / total);
|
||||
job->progress_(static_cast<float>(sent) / static_cast<float>(total));
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -388,7 +388,7 @@ Udisks2Lister::PartitionData Udisks2Lister::ReadPartitionData(const QDBusObjectP
|
||||
|
||||
for (const QByteArray &p : filesystem.mountPoints()) {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) // Workaround a bytearray to string conversion issue with Qt 6
|
||||
QString mountpoint = QByteArray(p.data(), strlen(p.data()));
|
||||
QString mountpoint = QByteArray(p.data(), static_cast<qint64>(strlen(p.data())));
|
||||
#else
|
||||
QString mountpoint = p;
|
||||
#endif
|
||||
|
@ -149,7 +149,7 @@ QString Chromaprinter::CreateFingerprint() {
|
||||
gst_message_unref(msg);
|
||||
}
|
||||
|
||||
const int decode_time = time.restart();
|
||||
const qint64 decode_time = time.restart();
|
||||
|
||||
buffer_.close();
|
||||
|
||||
@ -177,7 +177,7 @@ QString Chromaprinter::CreateFingerprint() {
|
||||
}
|
||||
chromaprint_free(chromaprint);
|
||||
|
||||
const int codegen_time = time.elapsed();
|
||||
const qint64 codegen_time = time.elapsed();
|
||||
|
||||
qLog(Debug) << "Decode time:" << decode_time << "Codegen time:" << codegen_time;
|
||||
|
||||
@ -216,7 +216,7 @@ GstFlowReturn Chromaprinter::NewBufferCallback(GstAppSink *app_sink, gpointer se
|
||||
if (buffer) {
|
||||
GstMapInfo map;
|
||||
if (gst_buffer_map(buffer, &map, GST_MAP_READ)) {
|
||||
me->buffer_.write(reinterpret_cast<const char*>(map.data), map.size);
|
||||
me->buffer_.write(reinterpret_cast<const char*>(map.data), static_cast<qint64>(map.size));
|
||||
gst_buffer_unmap(buffer, &map);
|
||||
}
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ struct SimpleMetaBundle {
|
||||
Song::FileType filetype;
|
||||
int samplerate;
|
||||
int bitdepth;
|
||||
qint64 bitrate;
|
||||
int bitrate;
|
||||
QString lyrics;
|
||||
};
|
||||
|
||||
|
@ -352,7 +352,7 @@ qint64 GstEngine::position_nanosec() const {
|
||||
|
||||
if (!current_pipeline_) return 0;
|
||||
|
||||
const qint64 result = current_pipeline_->position() - beginning_nanosec_;
|
||||
const qint64 result = current_pipeline_->position() - static_cast<qint64>(beginning_nanosec_);
|
||||
return qint64(qMax(0LL, result));
|
||||
|
||||
}
|
||||
@ -361,7 +361,7 @@ qint64 GstEngine::length_nanosec() const {
|
||||
|
||||
if (!current_pipeline_) return 0;
|
||||
|
||||
const qint64 result = end_nanosec_ - beginning_nanosec_;
|
||||
const qint64 result = end_nanosec_ - static_cast<qint64>(beginning_nanosec_);
|
||||
|
||||
if (result > 0) {
|
||||
return result;
|
||||
@ -512,7 +512,7 @@ void GstEngine::timerEvent(QTimerEvent *e) {
|
||||
const qint64 remaining = current_length - current_position;
|
||||
|
||||
const qint64 fudge = kTimerIntervalNanosec + 100 * kNsecPerMsec; // Mmm fudge
|
||||
const qint64 gap = buffer_duration_nanosec_ + (autocrossfade_enabled_ ? fadeout_duration_nanosec_ : kPreloadGapNanosec);
|
||||
const qint64 gap = static_cast<qint64>(buffer_duration_nanosec_) + (autocrossfade_enabled_ ? fadeout_duration_nanosec_ : kPreloadGapNanosec);
|
||||
|
||||
// only if we know the length of the current stream...
|
||||
if (current_length > 0) {
|
||||
@ -618,7 +618,7 @@ void GstEngine::SeekNow() {
|
||||
|
||||
if (!current_pipeline_) return;
|
||||
|
||||
if (!current_pipeline_->Seek(seek_pos_)) {
|
||||
if (!current_pipeline_->Seek(static_cast<qint64>(seek_pos_))) {
|
||||
qLog(Warning) << "Seek failed";
|
||||
}
|
||||
|
||||
@ -924,9 +924,9 @@ void GstEngine::StreamDiscovered(GstDiscoverer*, GstDiscovererInfo *info, GError
|
||||
bundle.url = instance->current_pipeline_->next_original_url();
|
||||
}
|
||||
bundle.stream_url = QUrl(discovered_url);
|
||||
bundle.samplerate = gst_discoverer_audio_info_get_sample_rate(GST_DISCOVERER_AUDIO_INFO(stream_info));
|
||||
bundle.bitdepth = gst_discoverer_audio_info_get_depth(GST_DISCOVERER_AUDIO_INFO(stream_info));
|
||||
bundle.bitrate = gst_discoverer_audio_info_get_bitrate(GST_DISCOVERER_AUDIO_INFO(stream_info)) / 1000;
|
||||
bundle.samplerate = static_cast<int>(gst_discoverer_audio_info_get_sample_rate(GST_DISCOVERER_AUDIO_INFO(stream_info)));
|
||||
bundle.bitdepth = static_cast<int>(gst_discoverer_audio_info_get_depth(GST_DISCOVERER_AUDIO_INFO(stream_info)));
|
||||
bundle.bitrate = static_cast<int>(gst_discoverer_audio_info_get_bitrate(GST_DISCOVERER_AUDIO_INFO(stream_info)) / 1000);
|
||||
|
||||
GstCaps *caps = gst_discoverer_stream_info_get_caps(stream_info);
|
||||
|
||||
|
@ -185,7 +185,7 @@ void GstEnginePipeline::set_replaygain(const bool enabled, const int mode, const
|
||||
|
||||
}
|
||||
|
||||
void GstEnginePipeline::set_buffer_duration_nanosec(const qint64 buffer_duration_nanosec) {
|
||||
void GstEnginePipeline::set_buffer_duration_nanosec(const quint64 buffer_duration_nanosec) {
|
||||
buffer_duration_nanosec_ = buffer_duration_nanosec;
|
||||
}
|
||||
|
||||
@ -209,14 +209,14 @@ void GstEnginePipeline::set_channels(const bool enabled, const int channels) {
|
||||
channels_ = channels;
|
||||
}
|
||||
|
||||
GstElement *GstEnginePipeline::CreateElement(const QString &factory_name, const QString &name, GstElement *bin, QString &error) {
|
||||
GstElement *GstEnginePipeline::CreateElement(const QString &factory_name, const QString &name, GstElement *bin, QString &error) const {
|
||||
|
||||
QString unique_name = QString("pipeline") + "-" + QString::number(id_) + "-" + (name.isEmpty() ? factory_name : name);
|
||||
|
||||
GstElement *element = gst_element_factory_make(factory_name.toUtf8().constData(), unique_name.toUtf8().constData());
|
||||
if (!element) {
|
||||
qLog(Error) << "GStreamer could not create the element" << factory_name << "with name" << unique_name;
|
||||
error = QString("GStreamer could not create the element %1 with name %2.").arg(factory_name).arg(unique_name);
|
||||
error = QString("GStreamer could not create the element %1 with name %2.").arg(factory_name, unique_name);
|
||||
}
|
||||
|
||||
if (bin && element) gst_bin_add(GST_BIN(bin), element);
|
||||
@ -586,7 +586,7 @@ GstPadProbeReturn GstEnginePipeline::EventHandoffCallback(GstPad*, GstPadProbeIn
|
||||
// The segment start time is used to calculate the proper offset of data buffers from the start of the stream
|
||||
const GstSegment *segment = nullptr;
|
||||
gst_event_parse_segment(e, &segment);
|
||||
instance->segment_start_ = segment->start;
|
||||
instance->segment_start_ = static_cast<qint64>(segment->start);
|
||||
instance->segment_start_received_ = true;
|
||||
}
|
||||
break;
|
||||
@ -663,7 +663,7 @@ void GstEnginePipeline::NewPadCallback(GstElement*, GstPad *pad, gpointer self)
|
||||
// Offset the timestamps on all the buffers coming out of the playbin so they line up exactly with the end of the last buffer from the old playbin.
|
||||
// "Running time" is the time since the last flushing seek.
|
||||
GstClockTime running_time = gst_segment_to_running_time(&instance->last_playbin_segment_, GST_FORMAT_TIME, instance->last_playbin_segment_.position);
|
||||
gst_pad_set_offset(pad, running_time);
|
||||
gst_pad_set_offset(pad, static_cast<gint64>(running_time));
|
||||
|
||||
// Add a probe to the pad so we can update last_playbin_segment_.
|
||||
gst_pad_add_probe(pad, static_cast<GstPadProbeType>(GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM | GST_PAD_PROBE_TYPE_EVENT_FLUSH), PlaybinProbe, instance, nullptr);
|
||||
@ -720,7 +720,7 @@ GstPadProbeReturn GstEnginePipeline::HandoffCallback(GstPad *pad, GstPadProbeInf
|
||||
GstEnginePipeline *instance = reinterpret_cast<GstEnginePipeline*>(self);
|
||||
|
||||
QString format;
|
||||
int channels = 0;
|
||||
int channels = 1;
|
||||
int rate = 0;
|
||||
|
||||
GstCaps *caps = gst_pad_get_current_caps(pad);
|
||||
@ -739,7 +739,7 @@ GstPadProbeReturn GstEnginePipeline::HandoffCallback(GstPad *pad, GstPadProbeInf
|
||||
|
||||
quint64 start_time = GST_BUFFER_TIMESTAMP(buf) - instance->segment_start_;
|
||||
quint64 duration = GST_BUFFER_DURATION(buf);
|
||||
qint64 end_time = start_time + duration;
|
||||
qint64 end_time = static_cast<qint64>(start_time + duration);
|
||||
|
||||
if (format.startsWith("S16LE")) {
|
||||
instance->logged_unsupported_analyzer_format_ = false;
|
||||
@ -1079,7 +1079,7 @@ void GstEnginePipeline::TagMessageReceived(GstMessage *msg) {
|
||||
bundle.artist = ParseStrTag(taglist, GST_TAG_ARTIST);
|
||||
bundle.comment = ParseStrTag(taglist, GST_TAG_COMMENT);
|
||||
bundle.album = ParseStrTag(taglist, GST_TAG_ALBUM);
|
||||
bundle.bitrate = ParseUIntTag(taglist, GST_TAG_BITRATE) / 1000;
|
||||
bundle.bitrate = static_cast<int>(ParseUIntTag(taglist, GST_TAG_BITRATE) / 1000);
|
||||
bundle.lyrics = ParseStrTag(taglist, GST_TAG_LYRICS);
|
||||
|
||||
if (!bundle.title.isEmpty() && bundle.artist.isEmpty() && bundle.album.isEmpty()) {
|
||||
@ -1259,7 +1259,7 @@ bool GstEnginePipeline::Seek(const qint64 nanosec) {
|
||||
|
||||
}
|
||||
|
||||
void GstEnginePipeline::SetVolume(const int percent) {
|
||||
void GstEnginePipeline::SetVolume(const uint percent) {
|
||||
|
||||
if (!volume_) return;
|
||||
volume_percent_ = percent;
|
||||
@ -1312,7 +1312,7 @@ void GstEnginePipeline::UpdateEqualizer() {
|
||||
|
||||
// Update band gains
|
||||
for (int i = 0; i < kEqBandCount; ++i) {
|
||||
float gain = eq_enabled_ ? eq_band_gains_[i] : static_cast<float>(0.0);
|
||||
float gain = eq_enabled_ ? static_cast<float>(eq_band_gains_[i]) : static_cast<float>(0.0);
|
||||
if (gain < 0) {
|
||||
gain *= 0.24;
|
||||
}
|
||||
@ -1357,7 +1357,7 @@ void GstEnginePipeline::StartFader(const qint64 duration_nanosec, const QTimeLin
|
||||
QObject::connect(fader_.get(), &QTimeLine::finished, this, &GstEnginePipeline::FaderTimelineFinished);
|
||||
fader_->setDirection(direction);
|
||||
fader_->setEasingCurve(shape);
|
||||
fader_->setCurrentTime(start_time);
|
||||
fader_->setCurrentTime(static_cast<int>(start_time));
|
||||
fader_->resume();
|
||||
|
||||
fader_fudge_timer_.stop();
|
||||
|
@ -68,7 +68,7 @@ class GstEnginePipeline : public QObject {
|
||||
void set_stereo_balancer_enabled(const bool enabled);
|
||||
void set_equalizer_enabled(const bool enabled);
|
||||
void set_replaygain(const bool enabled, const int mode, const double preamp, const double fallbackgain, const bool compression);
|
||||
void set_buffer_duration_nanosec(const qint64 duration_nanosec);
|
||||
void set_buffer_duration_nanosec(const quint64 duration_nanosec);
|
||||
void set_buffer_low_watermark(const double value);
|
||||
void set_buffer_high_watermark(const double value);
|
||||
void set_proxy_settings(const QString &address, const bool authentication, const QString &user, const QString &pass);
|
||||
@ -85,7 +85,7 @@ class GstEnginePipeline : public QObject {
|
||||
// Control the music playback
|
||||
QFuture<GstStateChangeReturn> SetState(const GstState state);
|
||||
Q_INVOKABLE bool Seek(const qint64 nanosec);
|
||||
void SetVolume(const int percent);
|
||||
void SetVolume(const uint percent);
|
||||
void SetStereoBalance(const float value);
|
||||
void SetEqualizerParams(const int preamp, const QList<int> &band_gains);
|
||||
|
||||
@ -138,7 +138,7 @@ class GstEnginePipeline : public QObject {
|
||||
void timerEvent(QTimerEvent*) override;
|
||||
|
||||
private:
|
||||
GstElement *CreateElement(const QString &factory_name, const QString &name, GstElement *bin, QString &error);
|
||||
GstElement *CreateElement(const QString &factory_name, const QString &name, GstElement *bin, QString &error) const;
|
||||
bool InitAudioBin(QString &error);
|
||||
|
||||
// Static callbacks. The GstEnginePipeline instance is passed in the last argument.
|
||||
@ -266,7 +266,7 @@ class GstEnginePipeline : public QObject {
|
||||
// Complete the transition to the next song when it starts playing
|
||||
bool next_uri_set_;
|
||||
|
||||
int volume_percent_;
|
||||
uint volume_percent_;
|
||||
qreal volume_modifier_;
|
||||
|
||||
std::unique_ptr<QTimeLine> fader_;
|
||||
|
@ -182,7 +182,7 @@ void VLCEngine::Seek(const quint64 offset_nanosec) {
|
||||
uint len = length();
|
||||
if (len == 0) return;
|
||||
|
||||
float pos = static_cast<float>(offset) / len;
|
||||
float pos = static_cast<float>(offset) / static_cast<float>(len);
|
||||
|
||||
libvlc_media_player_set_position(player_, pos);
|
||||
|
||||
@ -192,7 +192,7 @@ void VLCEngine::SetVolumeSW(const uint percent) {
|
||||
|
||||
if (!Initialized()) return;
|
||||
if (!volume_control_ && percent != 100) return;
|
||||
libvlc_audio_set_volume(player_, percent);
|
||||
libvlc_audio_set_volume(player_, static_cast<int>(percent));
|
||||
|
||||
}
|
||||
|
||||
@ -208,7 +208,7 @@ qint64 VLCEngine::position_nanosec() const {
|
||||
qint64 VLCEngine::length_nanosec() const {
|
||||
|
||||
if (state_ == Engine::Empty) return 0;
|
||||
const qint64 result = (end_nanosec_ - beginning_nanosec_);
|
||||
const qint64 result = (end_nanosec_ - static_cast<qint64>(beginning_nanosec_));
|
||||
if (result > 0) {
|
||||
return result;
|
||||
}
|
||||
@ -261,7 +261,7 @@ uint VLCEngine::position() const {
|
||||
if (!Initialized() || !libvlc_media_player_is_playing(player_)) return 0;
|
||||
|
||||
float pos = libvlc_media_player_get_position(player_);
|
||||
return (pos * length());
|
||||
return (static_cast<uint>(pos) * length());
|
||||
|
||||
}
|
||||
|
||||
|
@ -326,7 +326,7 @@ void Equalizer::Save() {
|
||||
s.beginGroup(kSettingsGroup);
|
||||
|
||||
// Presets
|
||||
s.beginWriteArray("presets", presets_.count());
|
||||
s.beginWriteArray("presets", static_cast<int>(presets_.count()));
|
||||
int i = 0;
|
||||
QStringList presets = presets_.keys();
|
||||
for (const QString &name : presets) {
|
||||
|
@ -25,9 +25,9 @@
|
||||
#include "globalshortcut.h"
|
||||
#include "keymapper_win.h"
|
||||
|
||||
quint32 GlobalShortcut::nativeModifiers(Qt::KeyboardModifiers qt_mods) {
|
||||
int GlobalShortcut::nativeModifiers(Qt::KeyboardModifiers qt_mods) {
|
||||
|
||||
quint32 native_mods = 0;
|
||||
int native_mods = 0;
|
||||
if (qt_mods & Qt::ShiftModifier) native_mods |= MOD_SHIFT;
|
||||
if (qt_mods & Qt::ControlModifier) native_mods |= MOD_CONTROL;
|
||||
if (qt_mods & Qt::AltModifier) native_mods |= MOD_ALT;
|
||||
@ -36,9 +36,9 @@ quint32 GlobalShortcut::nativeModifiers(Qt::KeyboardModifiers qt_mods) {
|
||||
|
||||
}
|
||||
|
||||
quint32 GlobalShortcut::nativeKeycode(Qt::Key qt_key) {
|
||||
int GlobalShortcut::nativeKeycode(Qt::Key qt_key) {
|
||||
|
||||
quint32 key_code = 0;
|
||||
int key_code = 0;
|
||||
if (KeyMapperWin::keymapper_win_.contains(qt_key)) {
|
||||
key_code = KeyMapperWin::keymapper_win_.value(qt_key);
|
||||
}
|
||||
@ -46,11 +46,11 @@ quint32 GlobalShortcut::nativeKeycode(Qt::Key qt_key) {
|
||||
|
||||
}
|
||||
|
||||
bool GlobalShortcut::registerShortcut(quint32 native_key, quint32 native_mods) {
|
||||
bool GlobalShortcut::registerShortcut(int native_key, int native_mods) {
|
||||
return RegisterHotKey(0, native_mods ^ native_key, native_mods, native_key);
|
||||
}
|
||||
|
||||
bool GlobalShortcut::unregisterShortcut(quint32 native_key, quint32 native_mods) {
|
||||
bool GlobalShortcut::unregisterShortcut(int native_key, int native_mods) {
|
||||
return UnregisterHotKey(0, native_mods ^ native_key);
|
||||
}
|
||||
|
||||
|
@ -123,9 +123,9 @@ quint32 AppRootWindow() {
|
||||
|
||||
} // namespace
|
||||
|
||||
quint32 GlobalShortcut::nativeModifiers(Qt::KeyboardModifiers qt_mods) {
|
||||
int GlobalShortcut::nativeModifiers(Qt::KeyboardModifiers qt_mods) {
|
||||
|
||||
quint32 native_mods = 0;
|
||||
int native_mods = 0;
|
||||
if (qt_mods & Qt::ShiftModifier) native_mods |= ShiftMask;
|
||||
if (qt_mods & Qt::ControlModifier) native_mods |= ControlMask;
|
||||
if (qt_mods & Qt::AltModifier) native_mods |= Mod1Mask;
|
||||
@ -134,7 +134,7 @@ quint32 GlobalShortcut::nativeModifiers(Qt::KeyboardModifiers qt_mods) {
|
||||
|
||||
}
|
||||
|
||||
quint32 GlobalShortcut::nativeKeycode(Qt::Key qt_key) {
|
||||
int GlobalShortcut::nativeKeycode(Qt::Key qt_key) {
|
||||
|
||||
Display *disp = X11Display();
|
||||
if (!disp) return false;
|
||||
@ -151,7 +151,7 @@ quint32 GlobalShortcut::nativeKeycode(Qt::Key qt_key) {
|
||||
|
||||
}
|
||||
|
||||
bool GlobalShortcut::registerShortcut(quint32 native_key, quint32 native_mods) {
|
||||
bool GlobalShortcut::registerShortcut(int native_key, int native_mods) {
|
||||
|
||||
Display *disp = X11Display();
|
||||
if (!disp) return false;
|
||||
@ -163,7 +163,7 @@ bool GlobalShortcut::registerShortcut(quint32 native_key, quint32 native_mods) {
|
||||
|
||||
}
|
||||
|
||||
bool GlobalShortcut::unregisterShortcut(quint32 native_key, quint32 native_mods) {
|
||||
bool GlobalShortcut::unregisterShortcut(int native_key, int native_mods) {
|
||||
|
||||
Display *disp = X11Display();
|
||||
if (!disp) return false;
|
||||
|
@ -55,11 +55,11 @@ class GlobalShortcut : public QObject, QAbstractNativeEventFilter {
|
||||
|
||||
static void activateShortcut(quint32 native_key, quint32 native_mods);
|
||||
|
||||
static quint32 nativeModifiers(Qt::KeyboardModifiers qt_mods);
|
||||
static quint32 nativeKeycode(Qt::Key qt_keycode);
|
||||
static int nativeModifiers(Qt::KeyboardModifiers qt_mods);
|
||||
static int nativeKeycode(Qt::Key qt_keycode);
|
||||
|
||||
static bool registerShortcut(quint32 native_key, quint32 native_mods);
|
||||
static bool unregisterShortcut(quint32 native_key, quint32 native_mods);
|
||||
static bool registerShortcut(int native_key, int native_mods);
|
||||
static bool unregisterShortcut(int native_key, int native_mods);
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
bool nativeEventFilter(const QByteArray &eventtype, void *message, qintptr *result) override;
|
||||
@ -75,8 +75,8 @@ class GlobalShortcut : public QObject, QAbstractNativeEventFilter {
|
||||
QKeySequence shortcut_;
|
||||
Qt::Key qt_key_;
|
||||
Qt::KeyboardModifiers qt_mods_;
|
||||
quint32 native_key_;
|
||||
quint32 native_mods_;
|
||||
int native_key_;
|
||||
int native_mods_;
|
||||
|
||||
};
|
||||
|
||||
|
@ -94,10 +94,10 @@ bool GlobalShortcutGrabber::event(QEvent *e) {
|
||||
QKeyEvent *ke = static_cast<QKeyEvent*>(e);
|
||||
|
||||
if (modifier_keys_.contains(ke->key())) {
|
||||
ret_ = QKeySequence(ke->modifiers());
|
||||
ret_ = QKeySequence(static_cast<int>(ke->modifiers()));
|
||||
}
|
||||
else {
|
||||
ret_ = QKeySequence(ke->modifiers() | ke->key());
|
||||
ret_ = QKeySequence(static_cast<int>(ke->modifiers() | ke->key()));
|
||||
}
|
||||
|
||||
UpdateText();
|
||||
|
@ -338,7 +338,7 @@ void InternetCollectionView::contextMenuEvent(QContextMenuEvent *e) {
|
||||
|
||||
context_menu_index_ = qobject_cast<QSortFilterProxyModel*>(model())->mapToSource(context_menu_index_);
|
||||
QModelIndexList selected_indexes = qobject_cast<QSortFilterProxyModel*>(model())->mapSelectionToSource(selectionModel()->selection()).indexes();
|
||||
int songs_selected = selected_indexes.count();;
|
||||
qint64 songs_selected = selected_indexes.count();
|
||||
|
||||
// In all modes
|
||||
load_->setEnabled(songs_selected > 0);
|
||||
|
@ -445,7 +445,7 @@ QStringList InternetSearchView::TokenizeQuery(const QString &query) {
|
||||
(*it).remove(')');
|
||||
(*it).remove('"');
|
||||
|
||||
const int colon = (*it).indexOf(":");
|
||||
const qint64 colon = (*it).indexOf(":");
|
||||
if (colon != -1) {
|
||||
(*it).remove(0, colon + 1);
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ bool LocalRedirectServer::GenerateCertificate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
QSslKey ssl_key(QByteArray(buffer, buffer_size), QSsl::Rsa);
|
||||
QSslKey ssl_key(QByteArray(buffer, static_cast<qint64>(buffer_size)), QSsl::Rsa);
|
||||
if (ssl_key.isNull()) {
|
||||
error_ = QString("Failed to generate random private key.");
|
||||
gnutls_x509_privkey_deinit(key);
|
||||
@ -146,8 +146,8 @@ bool LocalRedirectServer::GenerateCertificate() {
|
||||
return false;
|
||||
}
|
||||
quint64 time = QDateTime::currentDateTime().toSecsSinceEpoch();
|
||||
gnutls_x509_crt_set_activation_time(crt, time);
|
||||
if (int result = gnutls_x509_crt_set_expiration_time(crt, time + 31536000L) != GNUTLS_E_SUCCESS) {
|
||||
gnutls_x509_crt_set_activation_time(crt, static_cast<time_t>(time));
|
||||
if (int result = gnutls_x509_crt_set_expiration_time(crt, static_cast<time_t>(time + 31536000L)) != GNUTLS_E_SUCCESS) {
|
||||
error_ = QString("Failed to set the activation time of the certificate: %1").arg(gnutls_strerror(result));
|
||||
gnutls_x509_privkey_deinit(key);
|
||||
gnutls_x509_crt_deinit(crt);
|
||||
@ -220,7 +220,7 @@ bool LocalRedirectServer::GenerateCertificate() {
|
||||
gnutls_x509_privkey_deinit(key);
|
||||
gnutls_privkey_deinit(pkey);
|
||||
|
||||
QSslCertificate ssl_certificate(QByteArray(buffer, buffer_size));
|
||||
QSslCertificate ssl_certificate(QByteArray(buffer, static_cast<qint64>(buffer_size)));
|
||||
if (ssl_certificate.isNull()) {
|
||||
error_ = "Failed to generate random client certificate.";
|
||||
gnutls_global_deinit();
|
||||
@ -346,7 +346,7 @@ void LocalRedirectServer::WriteTemplate() const {
|
||||
page_file.close();
|
||||
|
||||
QRegularExpression tr_regexp("tr\\(\"([^\"]+)\"\\)");
|
||||
int offset = 0;
|
||||
qint64 offset = 0;
|
||||
forever {
|
||||
QRegularExpressionMatch re_match = tr_regexp.match(page_data, offset);
|
||||
if (!re_match.hasMatch()) break;
|
||||
|
@ -59,7 +59,7 @@ AuddLyricsProvider::~AuddLyricsProvider() {
|
||||
|
||||
}
|
||||
|
||||
bool AuddLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) {
|
||||
bool AuddLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const int id) {
|
||||
|
||||
Q_UNUSED(album);
|
||||
|
||||
@ -89,9 +89,9 @@ bool AuddLyricsProvider::StartSearch(const QString &artist, const QString &album
|
||||
|
||||
}
|
||||
|
||||
void AuddLyricsProvider::CancelSearch(const quint64 id) { Q_UNUSED(id); }
|
||||
void AuddLyricsProvider::CancelSearch(const int id) { Q_UNUSED(id); }
|
||||
|
||||
void AuddLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title) {
|
||||
void AuddLyricsProvider::HandleSearchReply(QNetworkReply *reply, const int id, const QString &artist, const QString &title) {
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
|
@ -42,15 +42,15 @@ class AuddLyricsProvider : public JsonLyricsProvider {
|
||||
explicit AuddLyricsProvider(NetworkAccessManager *network, QObject *parent = nullptr);
|
||||
~AuddLyricsProvider() override;
|
||||
|
||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, quint64 id) override;
|
||||
void CancelSearch(const quint64 id) override;
|
||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, int id) override;
|
||||
void CancelSearch(const int id) override;
|
||||
|
||||
private:
|
||||
void Error(const QString &error, const QVariant &debug = QVariant()) override;
|
||||
QJsonArray ExtractResult(QNetworkReply *reply, const QString &artist, const QString &title);
|
||||
|
||||
private slots:
|
||||
void HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title);
|
||||
void HandleSearchReply(QNetworkReply *reply, const int id, const QString &artist, const QString &title);
|
||||
|
||||
private:
|
||||
static const char *kUrlSearch;
|
||||
|
@ -53,7 +53,7 @@ ChartLyricsProvider::~ChartLyricsProvider() {
|
||||
|
||||
}
|
||||
|
||||
bool ChartLyricsProvider::StartSearch(const QString &artist, const QString&, const QString &title, const quint64 id) {
|
||||
bool ChartLyricsProvider::StartSearch(const QString &artist, const QString&, const QString &title, const int id) {
|
||||
|
||||
const ParamList params = ParamList() << Param("artist", artist)
|
||||
<< Param("song", title);
|
||||
@ -81,9 +81,9 @@ bool ChartLyricsProvider::StartSearch(const QString &artist, const QString&, con
|
||||
|
||||
}
|
||||
|
||||
void ChartLyricsProvider::CancelSearch(const quint64) {}
|
||||
void ChartLyricsProvider::CancelSearch(const int) {}
|
||||
|
||||
void ChartLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title) {
|
||||
void ChartLyricsProvider::HandleSearchReply(QNetworkReply *reply, const int id, const QString &artist, const QString &title) {
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
|
@ -40,14 +40,14 @@ class ChartLyricsProvider : public LyricsProvider {
|
||||
explicit ChartLyricsProvider(NetworkAccessManager *network, QObject *parent = nullptr);
|
||||
~ChartLyricsProvider() override;
|
||||
|
||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) override;
|
||||
void CancelSearch(quint64 id) override;
|
||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, const int id) override;
|
||||
void CancelSearch(int id) override;
|
||||
|
||||
private:
|
||||
void Error(const QString &error, const QVariant &debug = QVariant()) override;
|
||||
|
||||
private slots:
|
||||
void HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title);
|
||||
void HandleSearchReply(QNetworkReply *reply, const int id, const QString &artist, const QString &title);
|
||||
|
||||
private:
|
||||
static const char *kUrlSearch;
|
||||
|
@ -300,7 +300,7 @@ void GeniusLyricsProvider::AccessTokenRequestFinished(QNetworkReply *reply) {
|
||||
|
||||
}
|
||||
|
||||
bool GeniusLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) {
|
||||
bool GeniusLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const int id) {
|
||||
|
||||
Q_UNUSED(album);
|
||||
|
||||
@ -339,9 +339,9 @@ bool GeniusLyricsProvider::StartSearch(const QString &artist, const QString &alb
|
||||
|
||||
}
|
||||
|
||||
void GeniusLyricsProvider::CancelSearch(const quint64 id) { Q_UNUSED(id); }
|
||||
void GeniusLyricsProvider::CancelSearch(const int id) { Q_UNUSED(id); }
|
||||
|
||||
void GeniusLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 id) {
|
||||
void GeniusLyricsProvider::HandleSearchReply(QNetworkReply *reply, const int id) {
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
@ -499,11 +499,11 @@ void GeniusLyricsProvider::HandleLyricReply(QNetworkReply *reply, const int sear
|
||||
|
||||
QString tag_begin = "<div class=\"lyrics\">";
|
||||
QString tag_end = "</div>";
|
||||
int begin_idx = content.indexOf(tag_begin);
|
||||
qint64 begin_idx = content.indexOf(tag_begin);
|
||||
QString lyrics;
|
||||
if (begin_idx > 0) {
|
||||
begin_idx += tag_begin.length();
|
||||
int end_idx = content.indexOf(tag_end, begin_idx);
|
||||
qint64 end_idx = content.indexOf(tag_end, begin_idx);
|
||||
lyrics = content.mid(begin_idx, end_idx - begin_idx);
|
||||
lyrics = lyrics.remove(QRegularExpression("<[^>]*>"));
|
||||
lyrics = lyrics.trimmed();
|
||||
|
@ -53,8 +53,8 @@ class GeniusLyricsProvider : public JsonLyricsProvider {
|
||||
void Authenticate() override;
|
||||
void Deauthenticate() override { access_token_.clear(); }
|
||||
|
||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, quint64 id) override;
|
||||
void CancelSearch(const quint64 id) override;
|
||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, int id) override;
|
||||
void CancelSearch(const int id) override;
|
||||
|
||||
public:
|
||||
struct GeniusLyricsLyricContext {
|
||||
@ -82,7 +82,7 @@ class GeniusLyricsProvider : public JsonLyricsProvider {
|
||||
void HandleLoginSSLErrors(const QList<QSslError> &ssl_errors);
|
||||
void RedirectArrived();
|
||||
void AccessTokenRequestFinished(QNetworkReply *reply);
|
||||
void HandleSearchReply(QNetworkReply *reply, const quint64 id);
|
||||
void HandleSearchReply(QNetworkReply *reply, const int id);
|
||||
void HandleLyricReply(QNetworkReply *reply, const int search_id, const QUrl &url);
|
||||
|
||||
private:
|
||||
|
@ -54,7 +54,7 @@ LoloLyricsProvider::~LoloLyricsProvider() {
|
||||
|
||||
}
|
||||
|
||||
bool LoloLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) {
|
||||
bool LoloLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const int id) {
|
||||
|
||||
Q_UNUSED(album);
|
||||
|
||||
@ -84,9 +84,9 @@ bool LoloLyricsProvider::StartSearch(const QString &artist, const QString &album
|
||||
|
||||
}
|
||||
|
||||
void LoloLyricsProvider::CancelSearch(const quint64 id) { Q_UNUSED(id); }
|
||||
void LoloLyricsProvider::CancelSearch(const int id) { Q_UNUSED(id); }
|
||||
|
||||
void LoloLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title) {
|
||||
void LoloLyricsProvider::HandleSearchReply(QNetworkReply *reply, const int id, const QString &artist, const QString &title) {
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
|
@ -40,14 +40,14 @@ class LoloLyricsProvider : public LyricsProvider {
|
||||
explicit LoloLyricsProvider(NetworkAccessManager *network, QObject *parent = nullptr);
|
||||
~LoloLyricsProvider() override;
|
||||
|
||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) override;
|
||||
void CancelSearch(const quint64 id) override;
|
||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, const int id) override;
|
||||
void CancelSearch(const int id) override;
|
||||
|
||||
private:
|
||||
void Error(const QString &error, const QVariant &debug = QVariant()) override;
|
||||
|
||||
private slots:
|
||||
void HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title);
|
||||
void HandleSearchReply(QNetworkReply *reply, const int id, const QString &artist, const QString &title);
|
||||
|
||||
private:
|
||||
static const char *kUrlSearch;
|
||||
|
@ -45,7 +45,7 @@ LyricsFetcher::LyricsFetcher(LyricsProviders *lyrics_providers, QObject *parent)
|
||||
|
||||
}
|
||||
|
||||
quint64 LyricsFetcher::Search(const QString &artist, const QString &album, const QString &title) {
|
||||
int LyricsFetcher::Search(const QString &artist, const QString &album, const QString &title) {
|
||||
|
||||
LyricsSearchRequest request;
|
||||
request.artist = artist;
|
||||
@ -105,7 +105,7 @@ void LyricsFetcher::StartRequests() {
|
||||
|
||||
}
|
||||
|
||||
void LyricsFetcher::SingleSearchFinished(const quint64 request_id, const LyricsSearchResults &results) {
|
||||
void LyricsFetcher::SingleSearchFinished(const int request_id, const LyricsSearchResults &results) {
|
||||
|
||||
if (!active_requests_.contains(request_id)) return;
|
||||
|
||||
@ -115,7 +115,7 @@ void LyricsFetcher::SingleSearchFinished(const quint64 request_id, const LyricsS
|
||||
|
||||
}
|
||||
|
||||
void LyricsFetcher::SingleLyricsFetched(const quint64 request_id, const QString &provider, const QString &lyrics) {
|
||||
void LyricsFetcher::SingleLyricsFetched(const int request_id, const QString &provider, const QString &lyrics) {
|
||||
|
||||
if (!active_requests_.contains(request_id)) return;
|
||||
|
||||
|
@ -38,7 +38,7 @@ class LyricsFetcherSearch;
|
||||
|
||||
struct LyricsSearchRequest {
|
||||
explicit LyricsSearchRequest() : id(-1) {}
|
||||
quint64 id;
|
||||
int id;
|
||||
QString artist;
|
||||
QString album;
|
||||
QString title;
|
||||
@ -65,29 +65,29 @@ class LyricsFetcher : public QObject {
|
||||
explicit LyricsFetcher(LyricsProviders *lyrics_providers, QObject *parent = nullptr);
|
||||
~LyricsFetcher() override {}
|
||||
|
||||
quint64 Search(const QString &artist, const QString &album, const QString &title);
|
||||
int Search(const QString &artist, const QString &album, const QString &title);
|
||||
void Clear();
|
||||
|
||||
private:
|
||||
void AddRequest(const LyricsSearchRequest &req);
|
||||
|
||||
signals:
|
||||
void LyricsFetched(quint64 request_id, QString provider, QString lyrics);
|
||||
void SearchFinished(quint64 request_id, LyricsSearchResults results);
|
||||
void LyricsFetched(int request_id, QString provider, QString lyrics);
|
||||
void SearchFinished(int request_id, LyricsSearchResults results);
|
||||
|
||||
private slots:
|
||||
void SingleSearchFinished(const quint64 request_id, const LyricsSearchResults &results);
|
||||
void SingleLyricsFetched(const quint64 request_id, const QString &provider, const QString &lyrics);
|
||||
void SingleSearchFinished(const int request_id, const LyricsSearchResults &results);
|
||||
void SingleLyricsFetched(const int request_id, const QString &provider, const QString &lyrics);
|
||||
void StartRequests();
|
||||
|
||||
private:
|
||||
static const int kMaxConcurrentRequests;
|
||||
|
||||
LyricsProviders *lyrics_providers_;
|
||||
quint64 next_id_;
|
||||
int next_id_;
|
||||
|
||||
QQueue<LyricsSearchRequest> queued_requests_;
|
||||
QHash<quint64, LyricsFetcherSearch*> active_requests_;
|
||||
QHash<int, LyricsFetcherSearch*> active_requests_;
|
||||
|
||||
QTimer *request_starter_;
|
||||
|
||||
|
@ -78,7 +78,7 @@ void LyricsFetcherSearch::Start(LyricsProviders *lyrics_providers) {
|
||||
|
||||
}
|
||||
|
||||
void LyricsFetcherSearch::ProviderSearchFinished(const quint64 id, const LyricsSearchResults &results) {
|
||||
void LyricsFetcherSearch::ProviderSearchFinished(const int id, const LyricsSearchResults &results) {
|
||||
|
||||
if (!pending_requests_.contains(id)) return;
|
||||
LyricsProvider *provider = pending_requests_.take(id);
|
||||
|
@ -42,11 +42,11 @@ class LyricsFetcherSearch : public QObject {
|
||||
void Cancel();
|
||||
|
||||
signals:
|
||||
void SearchFinished(quint64, LyricsSearchResults results);
|
||||
void LyricsFetched(quint64, QString provider, QString lyrics);
|
||||
void SearchFinished(int, LyricsSearchResults results);
|
||||
void LyricsFetched(int, QString provider, QString lyrics);
|
||||
|
||||
private slots:
|
||||
void ProviderSearchFinished(const quint64 id, const LyricsSearchResults &results);
|
||||
void ProviderSearchFinished(const int id, const LyricsSearchResults &results);
|
||||
void TerminateSearch();
|
||||
|
||||
private:
|
||||
|
@ -49,8 +49,8 @@ class LyricsProvider : public QObject {
|
||||
void set_enabled(const bool enabled) { enabled_ = enabled; }
|
||||
void set_order(const int order) { order_ = order; }
|
||||
|
||||
virtual bool StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) = 0;
|
||||
virtual void CancelSearch(const quint64 id) { Q_UNUSED(id); }
|
||||
virtual bool StartSearch(const QString &artist, const QString &album, const QString &title, const int id) = 0;
|
||||
virtual void CancelSearch(const int id) { Q_UNUSED(id); }
|
||||
virtual bool AuthenticationRequired() const { return authentication_required_; }
|
||||
virtual void Authenticate() {}
|
||||
virtual bool IsAuthenticated() const { return !authentication_required_; }
|
||||
|
@ -52,7 +52,7 @@ MusixmatchLyricsProvider::~MusixmatchLyricsProvider() {
|
||||
|
||||
}
|
||||
|
||||
bool MusixmatchLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) {
|
||||
bool MusixmatchLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const int id) {
|
||||
|
||||
QString artist_stripped = artist;
|
||||
QString title_stripped = title;
|
||||
@ -93,9 +93,9 @@ bool MusixmatchLyricsProvider::StartSearch(const QString &artist, const QString
|
||||
|
||||
}
|
||||
|
||||
void MusixmatchLyricsProvider::CancelSearch(const quint64 id) { Q_UNUSED(id); }
|
||||
void MusixmatchLyricsProvider::CancelSearch(const int id) { Q_UNUSED(id); }
|
||||
|
||||
void MusixmatchLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &album, const QString &title) {
|
||||
void MusixmatchLyricsProvider::HandleSearchReply(QNetworkReply *reply, const int id, const QString &artist, const QString &album, const QString &title) {
|
||||
|
||||
Q_UNUSED(album);
|
||||
|
||||
@ -127,11 +127,11 @@ void MusixmatchLyricsProvider::HandleSearchReply(QNetworkReply *reply, const qui
|
||||
QString content = data;
|
||||
QString data_begin = "var __mxmState = ";
|
||||
QString data_end = ";</script>";
|
||||
int begin_idx = content.indexOf(data_begin);
|
||||
qint64 begin_idx = content.indexOf(data_begin);
|
||||
QString content_json;
|
||||
if (begin_idx > 0) {
|
||||
begin_idx += data_begin.length();
|
||||
int end_idx = content.indexOf(data_end, begin_idx);
|
||||
qint64 end_idx = content.indexOf(data_end, begin_idx);
|
||||
if (end_idx > begin_idx) {
|
||||
content_json = content.mid(begin_idx, end_idx - begin_idx);
|
||||
}
|
||||
|
@ -41,14 +41,14 @@ class MusixmatchLyricsProvider : public JsonLyricsProvider {
|
||||
explicit MusixmatchLyricsProvider(NetworkAccessManager *network, QObject *parent = nullptr);
|
||||
~MusixmatchLyricsProvider() override;
|
||||
|
||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) override;
|
||||
void CancelSearch(const quint64 id) override;
|
||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, const int id) override;
|
||||
void CancelSearch(const int id) override;
|
||||
|
||||
private:
|
||||
void Error(const QString &error, const QVariant &debug = QVariant()) override;
|
||||
|
||||
private slots:
|
||||
void HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &album, const QString &title);
|
||||
void HandleSearchReply(QNetworkReply *reply, const int id, const QString &artist, const QString &album, const QString &title);
|
||||
|
||||
private:
|
||||
QList<QNetworkReply*> replies_;
|
||||
|
@ -51,7 +51,7 @@ OVHLyricsProvider::~OVHLyricsProvider() {
|
||||
|
||||
}
|
||||
|
||||
bool OVHLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) {
|
||||
bool OVHLyricsProvider::StartSearch(const QString &artist, const QString &album, const QString &title, const int id) {
|
||||
|
||||
Q_UNUSED(album);
|
||||
|
||||
@ -72,9 +72,9 @@ bool OVHLyricsProvider::StartSearch(const QString &artist, const QString &album,
|
||||
|
||||
}
|
||||
|
||||
void OVHLyricsProvider::CancelSearch(const quint64 id) { Q_UNUSED(id); }
|
||||
void OVHLyricsProvider::CancelSearch(const int id) { Q_UNUSED(id); }
|
||||
|
||||
void OVHLyricsProvider::HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title) {
|
||||
void OVHLyricsProvider::HandleSearchReply(QNetworkReply *reply, const int id, const QString &artist, const QString &title) {
|
||||
|
||||
if (!replies_.contains(reply)) return;
|
||||
replies_.removeAll(reply);
|
||||
|
@ -40,14 +40,14 @@ class OVHLyricsProvider : public JsonLyricsProvider {
|
||||
explicit OVHLyricsProvider(NetworkAccessManager *network, QObject *parent = nullptr);
|
||||
~OVHLyricsProvider() override;
|
||||
|
||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, const quint64 id) override;
|
||||
void CancelSearch(const quint64 id) override;
|
||||
bool StartSearch(const QString &artist, const QString &album, const QString &title, const int id) override;
|
||||
void CancelSearch(const int id) override;
|
||||
|
||||
private:
|
||||
void Error(const QString &error, const QVariant &debug = QVariant()) override;
|
||||
|
||||
private slots:
|
||||
void HandleSearchReply(QNetworkReply *reply, const quint64 id, const QString &artist, const QString &title);
|
||||
void HandleSearchReply(QNetworkReply *reply, const int id, const QString &artist, const QString &title);
|
||||
|
||||
private:
|
||||
static const char *kUrlSearch;
|
||||
|
@ -104,7 +104,7 @@ void MoodbarBuilder::Normalize(QList<Rgb> *vals, double Rgb::*member) {
|
||||
for (const Rgb &rgb : *vals) {
|
||||
const double value = rgb.*member;
|
||||
if (value != mini && value != maxi) {
|
||||
avg += value / vals->count();
|
||||
avg += value / static_cast<double>(vals->count());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ void MoodbarRenderer::Render(const ColorVector &colors, QPainter *p, const QRect
|
||||
int start = static_cast<int>(x * colors.size() / rect.width());
|
||||
int end = static_cast<int>((x + 1) * colors.size() / rect.width());
|
||||
|
||||
if (start == end) end = qMin(start + 1, colors.size() - 1);
|
||||
if (start == end) end = qMin(start + 1, static_cast<int>(colors.size() - 1));
|
||||
|
||||
for (int j = start; j < end; j++) {
|
||||
r += colors[j].red();
|
||||
|
@ -205,7 +205,7 @@ void MusicBrainzClient::RequestFinished(QNetworkReply *reply, const int id, cons
|
||||
QObject::disconnect(reply, nullptr, this, nullptr);
|
||||
reply->deleteLater();
|
||||
|
||||
const int nb_removed = requests_.remove(id, reply);
|
||||
const qint64 nb_removed = requests_.remove(id, reply);
|
||||
if (nb_removed != 1) {
|
||||
qLog(Debug) << "MusicBrainz: Unknown reply received:" << nb_removed << "requests removed, while only one was supposed to be removed";
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ void Organize::SetSongProgress(float progress, bool transcoded) {
|
||||
|
||||
void Organize::UpdateProgress() {
|
||||
|
||||
const int total = task_count_ * 100;
|
||||
const quint64 total = task_count_ * 100;
|
||||
|
||||
#ifdef HAVE_GSTREAMER
|
||||
// Update transcoding progress
|
||||
|
@ -119,7 +119,7 @@ class Organize : public QObject {
|
||||
const bool overwrite_;
|
||||
const bool albumcover_;
|
||||
const bool eject_after_;
|
||||
int task_count_;
|
||||
quint64 task_count_;
|
||||
const QString playlist_;
|
||||
|
||||
QBasicTimer transcode_progress_timer_;
|
||||
|
@ -194,7 +194,7 @@ QString OrganizeFormat::ParseBlock(QString block, const Song &song, bool *any_em
|
||||
QRegularExpression block_regexp(kBlockPattern);
|
||||
|
||||
// Find any blocks first
|
||||
int pos = 0;
|
||||
qint64 pos = 0;
|
||||
QRegularExpressionMatch re_match;
|
||||
for (re_match = block_regexp.match(block, pos); re_match.hasMatch(); re_match = block_regexp.match(block, pos)) {
|
||||
pos = re_match.capturedStart();
|
||||
@ -331,7 +331,7 @@ QValidator::State OrganizeFormat::Validator::validate(QString &input, int&) cons
|
||||
|
||||
// Make sure the tags are valid
|
||||
QRegularExpressionMatch re_match;
|
||||
int pos = 0;
|
||||
qint64 pos = 0;
|
||||
for (re_match = tag_regexp.match(input, pos); re_match.hasMatch(); re_match = tag_regexp.match(input, pos)) {
|
||||
pos = re_match.capturedStart();
|
||||
if (!OrganizeFormat::kKnownTags.contains(re_match.captured(1))) {
|
||||
@ -365,14 +365,14 @@ void OrganizeFormat::SyntaxHighlighter::highlightBlock(const QString &text) {
|
||||
block_format.setBackground(QColor(block_color));
|
||||
|
||||
// Reset formatting
|
||||
setFormat(0, text.length(), QTextCharFormat());
|
||||
setFormat(0, static_cast<int>(text.length()), QTextCharFormat());
|
||||
|
||||
// Blocks
|
||||
QRegularExpressionMatch re_match;
|
||||
int pos = 0;
|
||||
qint64 pos = 0;
|
||||
for (re_match = block_regexp.match(text, pos); re_match.hasMatch(); re_match = block_regexp.match(text, pos)) {
|
||||
pos = re_match.capturedStart();
|
||||
setFormat(pos, re_match.capturedLength(), block_format);
|
||||
setFormat(static_cast<int>(pos), static_cast<int>(re_match.capturedLength()), block_format);
|
||||
pos += re_match.capturedLength();
|
||||
}
|
||||
|
||||
@ -380,10 +380,10 @@ void OrganizeFormat::SyntaxHighlighter::highlightBlock(const QString &text) {
|
||||
pos = 0;
|
||||
for (re_match = tag_regexp.match(text, pos); re_match.hasMatch(); re_match = tag_regexp.match(text, pos)) {
|
||||
pos = re_match.capturedStart();
|
||||
QTextCharFormat f = format(pos);
|
||||
QTextCharFormat f = format(static_cast<int>(pos));
|
||||
f.setForeground(QColor(OrganizeFormat::kKnownTags.contains(re_match.captured(1)) ? valid_tag_color : invalid_tag_color));
|
||||
|
||||
setFormat(pos, re_match.capturedLength(), f);
|
||||
setFormat(static_cast<int>(pos), static_cast<int>(re_match.capturedLength()), f);
|
||||
pos += re_match.capturedLength();
|
||||
}
|
||||
|
||||
|
@ -504,7 +504,7 @@ int Playlist::NextVirtualIndex(int i, const bool ignore_repeat_track) const {
|
||||
// This one's easy - if we have to repeat the current track then just return i
|
||||
if (repeat_mode == PlaylistSequence::Repeat_Track && !ignore_repeat_track) {
|
||||
if (!FilterContainsVirtualIndex(i)) {
|
||||
return virtual_items_.count(); // It's not in the filter any more
|
||||
return static_cast<int>(virtual_items_.count()); // It's not in the filter any more
|
||||
}
|
||||
return i;
|
||||
}
|
||||
@ -536,7 +536,7 @@ int Playlist::NextVirtualIndex(int i, const bool ignore_repeat_track) const {
|
||||
}
|
||||
|
||||
// Couldn't find one - return past the end of the list
|
||||
return virtual_items_.count();
|
||||
return static_cast<int>(virtual_items_.count());
|
||||
|
||||
}
|
||||
|
||||
@ -625,7 +625,7 @@ int Playlist::previous_row(const bool ignore_repeat_track) const {
|
||||
break;
|
||||
|
||||
default:
|
||||
prev_virtual_index = PreviousVirtualIndex(virtual_items_.count(), ignore_repeat_track);
|
||||
prev_virtual_index = PreviousVirtualIndex(static_cast<int>(virtual_items_.count()), ignore_repeat_track);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -684,7 +684,7 @@ void Playlist::set_current_row(const int i, const AutoScroll autoscroll, const b
|
||||
current_virtual_index_ = 0;
|
||||
}
|
||||
else if (is_shuffled_) {
|
||||
current_virtual_index_ = virtual_items_.indexOf(i);
|
||||
current_virtual_index_ = static_cast<int>(virtual_items_.indexOf(i));
|
||||
}
|
||||
else {
|
||||
current_virtual_index_ = i;
|
||||
@ -913,7 +913,7 @@ void Playlist::MoveItemsWithoutUndo(const QList<int> &source_rows, int pos) {
|
||||
moved_items.reserve(source_rows.count());
|
||||
|
||||
if (pos < 0) {
|
||||
pos = items_.count();
|
||||
pos = static_cast<int>(items_.count());
|
||||
}
|
||||
|
||||
// Take the items out of the list first, keeping track of whether the insertion point changes
|
||||
@ -935,7 +935,7 @@ void Playlist::MoveItemsWithoutUndo(const QList<int> &source_rows, int pos) {
|
||||
|
||||
// Update persistent indexes
|
||||
for (const QModelIndex &pidx : persistentIndexList()) {
|
||||
const int dest_offset = source_rows.indexOf(pidx.row());
|
||||
const int dest_offset = static_cast<int>(source_rows.indexOf(pidx.row()));
|
||||
if (dest_offset != -1) {
|
||||
// This index was moved
|
||||
changePersistentIndex(pidx, index(start + dest_offset, pidx.column(), QModelIndex()));
|
||||
@ -945,12 +945,12 @@ void Playlist::MoveItemsWithoutUndo(const QList<int> &source_rows, int pos) {
|
||||
for (int source_row : source_rows) {
|
||||
if (pidx.row() > source_row) d--;
|
||||
}
|
||||
if (pidx.row() + d >= start) d += source_rows.count();
|
||||
if (pidx.row() + d >= start) d += static_cast<int>(source_rows.count());
|
||||
|
||||
changePersistentIndex(pidx, index(pidx.row() + d, pidx.column(), QModelIndex()));
|
||||
}
|
||||
}
|
||||
current_virtual_index_ = virtual_items_.indexOf(current_row());
|
||||
current_virtual_index_ = static_cast<int>(virtual_items_.indexOf(current_row()));
|
||||
|
||||
emit layoutChanged();
|
||||
|
||||
@ -996,7 +996,7 @@ void Playlist::MoveItemsWithoutUndo(int start, const QList<int> &dest_rows) {
|
||||
else {
|
||||
int d = 0;
|
||||
if (pidx.row() >= start + dest_rows.count()) {
|
||||
d -= dest_rows.count();
|
||||
d -= static_cast<int>(dest_rows.count());
|
||||
}
|
||||
|
||||
for (int dest_row : dest_rows) {
|
||||
@ -1006,7 +1006,7 @@ void Playlist::MoveItemsWithoutUndo(int start, const QList<int> &dest_rows) {
|
||||
changePersistentIndex(pidx, index(pidx.row() + d, pidx.column(), QModelIndex()));
|
||||
}
|
||||
}
|
||||
current_virtual_index_ = virtual_items_.indexOf(current_row());
|
||||
current_virtual_index_ = static_cast<int>(virtual_items_.indexOf(current_row()));
|
||||
|
||||
emit layoutChanged();
|
||||
|
||||
@ -1029,7 +1029,7 @@ void Playlist::InsertItems(const PlaylistItemList &itemsIn, const int pos, const
|
||||
songs << item->Metadata();
|
||||
}
|
||||
|
||||
const int song_count = songs.length();
|
||||
const qint64 song_count = songs.length();
|
||||
QSet<Song> vetoed;
|
||||
for (SongInsertVetoListener *listener : veto_listeners_) {
|
||||
for (const Song &song : listener->AboutToInsertSongs(GetAllSongs(), songs)) {
|
||||
@ -1086,7 +1086,7 @@ void Playlist::InsertItemsWithoutUndo(const PlaylistItemList &items, const int p
|
||||
for (int i = start; i <= end; ++i) {
|
||||
PlaylistItemPtr item = items[i - start];
|
||||
items_.insert(i, item);
|
||||
virtual_items_ << virtual_items_.count();
|
||||
virtual_items_ << static_cast<int>(virtual_items_.count());
|
||||
|
||||
if (item->source() == Song::Source_Collection) {
|
||||
int id = item->Metadata().id();
|
||||
@ -1323,8 +1323,8 @@ bool Playlist::ComparePathDepths(const Qt::SortOrder order, std::shared_ptr<Play
|
||||
std::shared_ptr<PlaylistItem> a = order == Qt::AscendingOrder ? _a : _b;
|
||||
std::shared_ptr<PlaylistItem> b = order == Qt::AscendingOrder ? _b : _a;
|
||||
|
||||
int a_dir_level = a->Url().path().count('/');
|
||||
int b_dir_level = b->Url().path().count('/');
|
||||
qint64 a_dir_level = a->Url().path().count('/');
|
||||
qint64 b_dir_level = b->Url().path().count('/');
|
||||
|
||||
return a_dir_level < b_dir_level;
|
||||
|
||||
@ -1638,7 +1638,7 @@ bool Playlist::removeRows(QList<int> &rows) {
|
||||
}
|
||||
|
||||
// and now we're removing the current sequence
|
||||
if (!removeRows(part.last(), part.size())) {
|
||||
if (!removeRows(part.last(), static_cast<int>(part.size()))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1686,14 +1686,14 @@ PlaylistItemList Playlist::RemoveItemsWithoutUndo(const int row, const int count
|
||||
// Reset current_virtual_index_
|
||||
if (current_row() == -1) {
|
||||
if (row - 1 > 0 && row - 1 < items_.size()) {
|
||||
current_virtual_index_ = virtual_items_.indexOf(row - 1);
|
||||
current_virtual_index_ = static_cast<int>(virtual_items_.indexOf(row - 1));
|
||||
}
|
||||
else {
|
||||
current_virtual_index_ = -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
current_virtual_index_ = virtual_items_.indexOf(current_row());
|
||||
current_virtual_index_ = static_cast<int>(virtual_items_.indexOf(current_row()));
|
||||
}
|
||||
|
||||
ScheduleSave();
|
||||
@ -1781,7 +1781,7 @@ void Playlist::Clear() {
|
||||
// If loading songs from session restore async, don't insert them
|
||||
cancel_restore_ = true;
|
||||
|
||||
const int count = items_.count();
|
||||
const int count = static_cast<int>(items_.count());
|
||||
|
||||
if (count > kUndoItemLimit) {
|
||||
// Too big to keep in the undo stack. Also clear the stack because it might have been invalidated.
|
||||
@ -1818,7 +1818,7 @@ void Playlist::ExpandDynamicPlaylist() {
|
||||
void Playlist::RemoveItemsNotInQueue() {
|
||||
|
||||
if (queue_->is_empty() && !current_item_index_.isValid()) {
|
||||
RemoveItemsWithoutUndo(0, items_.count());
|
||||
RemoveItemsWithoutUndo(0, static_cast<int>(items_.count()));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1899,7 +1899,7 @@ void Playlist::Shuffle() {
|
||||
begin += current_item_index_.row() + 1;
|
||||
}
|
||||
|
||||
const int count = items_.count();
|
||||
const int count = static_cast<int>(items_.count());
|
||||
for (int i = begin; i < count; ++i) {
|
||||
int new_pos = i + (rand() % (count - i));
|
||||
|
||||
@ -1934,7 +1934,7 @@ void Playlist::ReshuffleIndices() {
|
||||
// No shuffling - sort the virtual item list normally.
|
||||
std::sort(virtual_items_.begin(), virtual_items_.end());
|
||||
if (current_row() != -1) {
|
||||
current_virtual_index_ = virtual_items_.indexOf(current_row());
|
||||
current_virtual_index_ = static_cast<int>(virtual_items_.indexOf(current_row()));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -1979,7 +1979,7 @@ void Playlist::ReshuffleIndices() {
|
||||
// Or if the song was not playing but it was selected, force its album to be first.
|
||||
if (current_virtual_index_ != -1 || current_row() != -1) {
|
||||
const QString key = items_[current_row()]->Metadata().AlbumKey();
|
||||
const int pos = shuffled_album_keys.indexOf(key);
|
||||
const qint64 pos = shuffled_album_keys.indexOf(key);
|
||||
if (pos >= 1) {
|
||||
std::swap(shuffled_album_keys[0], shuffled_album_keys[pos]);
|
||||
}
|
||||
|
@ -500,7 +500,7 @@ void SongSourceDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
|
||||
QPixmap pixmap = LookupPixmap(source, option_copy.decorationSize);
|
||||
|
||||
QWidget *parent_widget = qobject_cast<QWidget*>(parent());
|
||||
int device_pixel_ratio = parent_widget->devicePixelRatio();
|
||||
qreal device_pixel_ratio = parent_widget->devicePixelRatio();
|
||||
|
||||
// Draw the pixmap in the middle of the rectangle
|
||||
QRect draw_rect(QPoint(0, 0), option_copy.decorationSize / device_pixel_ratio);
|
||||
|
@ -43,7 +43,7 @@ InsertItems::InsertItems(Playlist *playlist, const PlaylistItemList &items, int
|
||||
enqueue_(enqueue),
|
||||
enqueue_next_(enqueue_next) {
|
||||
|
||||
setText(tr("add %n songs", "", items_.count()));
|
||||
setText(tr("add %n songs", "", static_cast<int>(items_.count())));
|
||||
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ void InsertItems::redo() {
|
||||
|
||||
void InsertItems::undo() {
|
||||
const int start = pos_ == -1 ? static_cast<int>(playlist_->rowCount() - items_.count()) : pos_;
|
||||
playlist_->RemoveItemsWithoutUndo(start, items_.count());
|
||||
playlist_->RemoveItemsWithoutUndo(start, static_cast<int>(items_.count()));
|
||||
}
|
||||
|
||||
bool InsertItems::UpdateItem(const PlaylistItemPtr &updated_item) {
|
||||
@ -109,7 +109,7 @@ MoveItems::MoveItems(Playlist *playlist, const QList<int> &source_rows, int pos)
|
||||
source_rows_(source_rows),
|
||||
pos_(pos) {
|
||||
|
||||
setText(tr("move %n songs", "", source_rows.count()));
|
||||
setText(tr("move %n songs", "", static_cast<int>(source_rows.count())));
|
||||
|
||||
}
|
||||
|
||||
|
@ -744,7 +744,7 @@ QModelIndex PlaylistView::NextEditableIndex(const QModelIndex ¤t) {
|
||||
|
||||
QList<int> columns = GetEditableColumns();
|
||||
QHeaderView *h = header();
|
||||
int idx = columns.indexOf(h->visualIndex(current.column()));
|
||||
int idx = static_cast<int>(columns.indexOf(h->visualIndex(current.column())));
|
||||
|
||||
if (idx + 1 >= columns.size()) {
|
||||
return model()->index(current.row() + 1, h->logicalIndex(columns.first()));
|
||||
@ -758,7 +758,7 @@ QModelIndex PlaylistView::PrevEditableIndex(const QModelIndex ¤t) {
|
||||
|
||||
QList<int> columns = GetEditableColumns();
|
||||
QHeaderView *h = header();
|
||||
int idx = columns.indexOf(h->visualIndex(current.column()));
|
||||
int idx = static_cast<int>(columns.indexOf(h->visualIndex(current.column())));
|
||||
|
||||
if (idx - 1 < 0) {
|
||||
return model()->index(current.row() - 1, h->logicalIndex(columns.last()));
|
||||
@ -1459,7 +1459,7 @@ void PlaylistView::set_background_image(const QImage &image) {
|
||||
// Apply opacity filter
|
||||
uchar *bits = background_image_.bits();
|
||||
for (int i = 0; i < background_image_.height() * background_image_.bytesPerLine(); i += 4) {
|
||||
bits[i + 3] = (opacity_level_ / 100.0) * 255;
|
||||
bits[i + 3] = static_cast<uchar>((opacity_level_ / 100.0) * 255);
|
||||
}
|
||||
|
||||
if (blur_radius_ != 0) {
|
||||
|
@ -52,7 +52,7 @@ SongList AsxIniParser::Load(QIODevice *device, const QString &playlist_path, con
|
||||
|
||||
while (!device->atEnd()) {
|
||||
QString line = QString::fromUtf8(device->readLine()).trimmed();
|
||||
int equals = line.indexOf('=');
|
||||
qint64 equals = line.indexOf('=');
|
||||
QString key = line.left(equals).toLower();
|
||||
QString value = line.mid(equals + 1);
|
||||
|
||||
|
@ -50,7 +50,7 @@ SongList ASXParser::Load(QIODevice *device, const QString &playlist_path, const
|
||||
|
||||
// Some playlists have unescaped & characters in URLs :(
|
||||
QRegularExpression ex("(href\\s*=\\s*\")([^\"]+)\"", QRegularExpression::CaseInsensitiveOption);
|
||||
int index = 0;
|
||||
qint64 index = 0;
|
||||
for (QRegularExpressionMatch re_match = ex.match(data, index); re_match.hasMatch(); re_match = ex.match(data, index)) {
|
||||
index = re_match.capturedStart();
|
||||
QString url = re_match.captured(2);
|
||||
|
@ -53,7 +53,7 @@ SongList PLSParser::Load(QIODevice *device, const QString &playlist_path, const
|
||||
|
||||
while (!device->atEnd()) {
|
||||
QString line = QString::fromUtf8(device->readLine()).trimmed();
|
||||
int equals = line.indexOf('=');
|
||||
qint64 equals = line.indexOf('=');
|
||||
QString key = line.left(equals).toLower();
|
||||
QString value = line.mid(equals + 1);
|
||||
|
||||
|
@ -1007,7 +1007,7 @@ QString QobuzRequest::ParseSong(Song &song, const QJsonObject &json_obj, QString
|
||||
QString title = json_obj["title"].toString();
|
||||
int track = json_obj["track_number"].toInt();
|
||||
QString copyright = json_obj["copyright"].toString();
|
||||
quint64 duration = json_obj["duration"].toInt() * kNsecPerSec;
|
||||
qint64 duration = json_obj["duration"].toInt() * kNsecPerSec;
|
||||
//bool streamable = json_obj["streamable"].toBool();
|
||||
QString composer;
|
||||
QString performer;
|
||||
|
@ -144,7 +144,7 @@ QModelIndex Queue::parent(const QModelIndex &child) const {
|
||||
|
||||
int Queue::rowCount(const QModelIndex &parent) const {
|
||||
if (parent.isValid()) return 0;
|
||||
return source_indexes_.count();
|
||||
return static_cast<int>(source_indexes_.count());
|
||||
}
|
||||
|
||||
int Queue::columnCount(const QModelIndex&) const { return 1; }
|
||||
@ -184,7 +184,7 @@ void Queue::ToggleTracks(const QModelIndexList &source_indexes) {
|
||||
}
|
||||
else {
|
||||
// Enqueue the track
|
||||
const int row = source_indexes_.count();
|
||||
const int row = static_cast<int>(source_indexes_.count());
|
||||
beginInsertRows(QModelIndex(), row, row);
|
||||
source_indexes_ << QPersistentModelIndex(source_index);
|
||||
endInsertRows();
|
||||
@ -206,7 +206,7 @@ void Queue::InsertFirst(const QModelIndexList &source_indexes) {
|
||||
}
|
||||
}
|
||||
|
||||
const int rows = source_indexes.count();
|
||||
const int rows = static_cast<int>(source_indexes.count());
|
||||
// Enqueue the tracks at the beginning
|
||||
beginInsertRows(QModelIndex(), 0, rows - 1);
|
||||
int offset = 0;
|
||||
@ -224,7 +224,7 @@ int Queue::PositionOf(const QModelIndex &source_index) const {
|
||||
|
||||
bool Queue::is_empty() const { return source_indexes_.isEmpty(); }
|
||||
|
||||
int Queue::ItemCount() const { return source_indexes_.length(); }
|
||||
int Queue::ItemCount() const { return static_cast<int>(source_indexes_.length()); }
|
||||
|
||||
quint64 Queue::GetTotalLength() const { return total_length_ns_; }
|
||||
|
||||
@ -295,7 +295,7 @@ void Queue::Move(const QList<int> &proxy_rows, int pos) {
|
||||
|
||||
// Update persistent indexes
|
||||
for (const QModelIndex &pidx : persistentIndexList()) {
|
||||
const int dest_offset = proxy_rows.indexOf(pidx.row());
|
||||
const int dest_offset = static_cast<int>(proxy_rows.indexOf(pidx.row()));
|
||||
if (dest_offset != -1) {
|
||||
// This index was moved
|
||||
changePersistentIndex(pidx, index(start + dest_offset, pidx.column(), QModelIndex()));
|
||||
@ -305,7 +305,7 @@ void Queue::Move(const QList<int> &proxy_rows, int pos) {
|
||||
for (int row : proxy_rows) {
|
||||
if (pidx.row() > row) d--;
|
||||
}
|
||||
if (pidx.row() + d >= start) d += proxy_rows.count();
|
||||
if (pidx.row() + d >= start) d += static_cast<int>(proxy_rows.count());
|
||||
|
||||
changePersistentIndex(pidx, index(pidx.row() + d, pidx.column(), QModelIndex()));
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ void RadioModel::AddChannels(const RadioChannelList &channels) {
|
||||
container = container_nodes_[channel.source];
|
||||
}
|
||||
else {
|
||||
beginInsertRows(ItemToIndex(root_), root_->children.count(), root_->children.count());
|
||||
beginInsertRows(ItemToIndex(root_), static_cast<int>(root_->children.count()), static_cast<int>(root_->children.count()));
|
||||
RadioItem *item = new RadioItem(RadioItem::Type_Service, root_);
|
||||
item->source = channel.source;
|
||||
item->display_text = Song::DescriptionForSource(channel.source);
|
||||
@ -184,7 +184,7 @@ void RadioModel::AddChannels(const RadioChannelList &channels) {
|
||||
endInsertRows();
|
||||
container = item;
|
||||
}
|
||||
beginInsertRows(ItemToIndex(container), container->children.count(), container->children.count());
|
||||
beginInsertRows(ItemToIndex(container), static_cast<int>(container->children.count()), static_cast<int>(container->children.count()));
|
||||
RadioItem *item = new RadioItem(RadioItem::Type_Channel, container);
|
||||
item->source = channel.source;
|
||||
item->display_text = channel.name;
|
||||
|
@ -169,7 +169,7 @@ void AudioScrobbler::ClearPlaying() {
|
||||
|
||||
}
|
||||
|
||||
void AudioScrobbler::Scrobble(const Song &song, const int scrobble_point) {
|
||||
void AudioScrobbler::Scrobble(const Song &song, const qint64 scrobble_point) {
|
||||
|
||||
if (!sources_.contains(song.source())) return;
|
||||
|
||||
|
@ -52,7 +52,7 @@ class AudioScrobbler : public QObject {
|
||||
|
||||
void UpdateNowPlaying(const Song &song);
|
||||
void ClearPlaying();
|
||||
void Scrobble(const Song &song, const int scrobble_point);
|
||||
void Scrobble(const Song &song, const qint64 scrobble_point);
|
||||
void ShowConfig();
|
||||
|
||||
ScrobblerService *ServiceByName(const QString &name) const { return scrobbler_services_->ServiceByName(name); }
|
||||
|
@ -125,7 +125,7 @@ void ListenBrainzScrobbler::LoadSession() {
|
||||
s.endGroup();
|
||||
|
||||
if (!refresh_token_.isEmpty()) {
|
||||
qint64 time = expires_in_ - (QDateTime::currentDateTime().toSecsSinceEpoch() - login_time_);
|
||||
qint64 time = expires_in_ - (QDateTime::currentDateTime().toSecsSinceEpoch() - static_cast<qint64>(login_time_));
|
||||
if (time < 6) time = 6;
|
||||
refresh_login_timer_.setInterval(static_cast<int>(time * kMsecPerSec));
|
||||
refresh_login_timer_.start();
|
||||
@ -644,7 +644,8 @@ void ListenBrainzScrobbler::Error(const QString &error, const QVariant &debug) {
|
||||
|
||||
void ListenBrainzScrobbler::CheckScrobblePrevSong() {
|
||||
|
||||
quint64 duration = QDateTime::currentDateTime().toSecsSinceEpoch() - timestamp_;
|
||||
qint64 duration = QDateTime::currentDateTime().toSecsSinceEpoch() - static_cast<qint64>(timestamp_);
|
||||
if (duration < 0) duration = 0;
|
||||
|
||||
if (!scrobbled_ && song_playing_.is_metadata_good() && song_playing_.is_radio() && duration > 30) {
|
||||
Song song(song_playing_);
|
||||
|
@ -1092,7 +1092,8 @@ QString ScrobblingAPI20::ErrorString(const ScrobbleErrorCode error) {
|
||||
|
||||
void ScrobblingAPI20::CheckScrobblePrevSong() {
|
||||
|
||||
quint64 duration = QDateTime::currentDateTime().toSecsSinceEpoch() - timestamp_;
|
||||
qint64 duration = QDateTime::currentDateTime().toSecsSinceEpoch() - static_cast<qint64>(timestamp_);
|
||||
if (duration < 0) duration = 0;
|
||||
|
||||
if (!scrobbled_ && song_playing_.is_metadata_good() && song_playing_.is_radio() && duration > 30) {
|
||||
Song song(song_playing_);
|
||||
|
@ -235,7 +235,7 @@ void SmartPlaylistQueryWizardPlugin::AddSearchTerm() {
|
||||
QObject::connect(widget, &SmartPlaylistSearchTermWidget::RemoveClicked, this, &SmartPlaylistQueryWizardPlugin::RemoveSearchTerm);
|
||||
QObject::connect(widget, &SmartPlaylistSearchTermWidget::Changed, this, &SmartPlaylistQueryWizardPlugin::UpdateTermPreview);
|
||||
|
||||
search_page_->layout_->insertWidget(search_page_->terms_.count(), widget);
|
||||
search_page_->layout_->insertWidget(static_cast<int>(search_page_->terms_.count()), widget);
|
||||
search_page_->terms_ << widget;
|
||||
|
||||
UpdateTermPreview();
|
||||
@ -247,7 +247,7 @@ void SmartPlaylistQueryWizardPlugin::RemoveSearchTerm() {
|
||||
SmartPlaylistSearchTermWidget *widget = qobject_cast<SmartPlaylistSearchTermWidget*>(sender());
|
||||
if (!widget) return;
|
||||
|
||||
const int index = search_page_->terms_.indexOf(widget);
|
||||
const qint64 index = search_page_->terms_.indexOf(widget);
|
||||
if (index == -1) return;
|
||||
|
||||
search_page_->terms_.takeAt(index)->deleteLater();
|
||||
|
@ -126,7 +126,7 @@ void SmartPlaylistsModel::Init() {
|
||||
// How many defaults do we have to write?
|
||||
int unwritten_defaults = 0;
|
||||
for (int i = version; i < default_smart_playlists_.count(); ++i) {
|
||||
unwritten_defaults += default_smart_playlists_[i].count();
|
||||
unwritten_defaults += static_cast<int>(default_smart_playlists_[i].count());
|
||||
}
|
||||
|
||||
// Save the defaults if there are any unwritten ones
|
||||
@ -230,7 +230,7 @@ void SmartPlaylistsModel::DeleteGenerator(const QModelIndex &idx) {
|
||||
s.beginGroup(kSettingsGroup);
|
||||
|
||||
// Rewrite all the items to the settings
|
||||
s.beginWriteArray(backend_->songs_table(), root_->children.count());
|
||||
s.beginWriteArray(backend_->songs_table(), static_cast<int>(root_->children.count()));
|
||||
int i = 0;
|
||||
for (SmartPlaylistsItem *item : root_->children) {
|
||||
s.setArrayIndex(i++);
|
||||
|
@ -129,7 +129,7 @@ void SmartPlaylistWizard::SetGenerator(PlaylistGeneratorPtr gen) {
|
||||
|
||||
void SmartPlaylistWizard::AddPlugin(SmartPlaylistWizardPlugin *plugin) {
|
||||
|
||||
const int index = plugins_.count();
|
||||
const int index = static_cast<int>(plugins_.count());
|
||||
plugins_ << plugin;
|
||||
plugin->Init(this, finish_id_);
|
||||
|
||||
|
@ -554,7 +554,7 @@ QString SubsonicRequest::ParseSong(Song &song, const QJsonObject &json_obj, cons
|
||||
size = json_obj["size"].toInt();
|
||||
}
|
||||
|
||||
quint64 duration = 0;
|
||||
qint64 duration = 0;
|
||||
if (json_obj["duration"].type() == QJsonValue::String) {
|
||||
duration = json_obj["duration"].toString().toInt() * kNsecPerSec;
|
||||
}
|
||||
|
@ -1049,7 +1049,7 @@ QString TidalRequest::ParseSong(Song &song, const QJsonObject &json_obj, const Q
|
||||
url.setPath(song_id);
|
||||
|
||||
QVariant q_duration = json_duration.toVariant();
|
||||
quint64 duration = 0;
|
||||
qint64 duration = 0;
|
||||
if (q_duration.isValid()) {
|
||||
duration = q_duration.toLongLong() * kNsecPerSec;
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ void TidalService::LoadSession() {
|
||||
s.endGroup();
|
||||
|
||||
if (!refresh_token_.isEmpty()) {
|
||||
qint64 time = expires_in_ - (QDateTime::currentDateTime().toSecsSinceEpoch() - login_time_);
|
||||
qint64 time = static_cast<qint64>(expires_in_) - (QDateTime::currentDateTime().toSecsSinceEpoch() - static_cast<qint64>(login_time_));
|
||||
if (time <= 0) {
|
||||
timer_refresh_login_->setInterval(200ms);
|
||||
}
|
||||
@ -302,7 +302,7 @@ void TidalService::ReloadSettings() {
|
||||
|
||||
s.endGroup();
|
||||
|
||||
timer_search_delay_->setInterval(search_delay);
|
||||
timer_search_delay_->setInterval(static_cast<int>(search_delay));
|
||||
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user