Fix a few narrowing conversions (#761)
* Fix narrowing conversion in album cover loader
* Fix narrowing conversions in discogs cover provider
* Fix narrowing conversions in spotify cover provider
* Add explicit conversion in moodbarbuilder
* Fix narrowing conversions in osd dbus
* Make WordyTimeNanosec use unsigned quint64
* Fix narrowing conversions in song
* Fix narrowing conversions in qobuz stream url request
* Make ConnectionInfo.msgLen use unsigned quint64
* Make AnalizerBase.timeout to signed int
* Fix narrowing conversions in album cover fetcher
* Make fht type be unsigned int
* Correct for type in blockanalizer and use std::fill where possible
* Revert "Fix narrowing conversions in song"
This reverts commit 3de291394d
.
This commit is contained in:
parent
e77e914f44
commit
0637b65846
|
@ -55,7 +55,7 @@ struct InstancesInfo {
|
||||||
|
|
||||||
struct ConnectionInfo {
|
struct ConnectionInfo {
|
||||||
explicit ConnectionInfo() : msgLen(0), instanceId(0), stage(0) {}
|
explicit ConnectionInfo() : msgLen(0), instanceId(0), stage(0) {}
|
||||||
qint64 msgLen;
|
quint64 msgLen;
|
||||||
quint32 instanceId;
|
quint32 instanceId;
|
||||||
quint8 stage;
|
quint8 stage;
|
||||||
};
|
};
|
||||||
|
|
|
@ -57,11 +57,11 @@ class Base : public QWidget {
|
||||||
public:
|
public:
|
||||||
~Base() override { delete fht_; }
|
~Base() override { delete fht_; }
|
||||||
|
|
||||||
uint timeout() const { return timeout_; }
|
int timeout() const { return timeout_; }
|
||||||
|
|
||||||
void set_engine(EngineBase *engine) { engine_ = engine; }
|
void set_engine(EngineBase *engine) { engine_ = engine; }
|
||||||
|
|
||||||
void changeTimeout(uint newTimeout) {
|
void changeTimeout(int newTimeout) {
|
||||||
timeout_ = newTimeout;
|
timeout_ = newTimeout;
|
||||||
if (timer_.isActive()) {
|
if (timer_.isActive()) {
|
||||||
timer_.stop();
|
timer_.stop();
|
||||||
|
@ -90,7 +90,7 @@ class Base : public QWidget {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QBasicTimer timer_;
|
QBasicTimer timer_;
|
||||||
uint timeout_;
|
int timeout_;
|
||||||
FHT *fht_;
|
FHT *fht_;
|
||||||
EngineBase *engine_;
|
EngineBase *engine_;
|
||||||
Scope lastscope_;
|
Scope lastscope_;
|
||||||
|
|
|
@ -62,7 +62,7 @@ BlockAnalyzer::BlockAnalyzer(QWidget *parent)
|
||||||
setMaximumWidth(kMaxColumns * (kWidth + 1) - 1);
|
setMaximumWidth(kMaxColumns * (kWidth + 1) - 1);
|
||||||
|
|
||||||
// mxcl says null pixmaps cause crashes, so let's play it safe
|
// mxcl says null pixmaps cause crashes, so let's play it safe
|
||||||
for (uint i = 0; i < kFadeSize; ++i) fade_bars_[i] = QPixmap(1, 1);
|
std::fill(fade_bars_.begin(), fade_bars_.end(), QPixmap(1, 1));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ void BlockAnalyzer::resizeEvent(QResizeEvent *e) {
|
||||||
// all is explained in analyze()..
|
// all is explained in analyze()..
|
||||||
// +1 to counter -1 in maxSizes, trust me we need this!
|
// +1 to counter -1 in maxSizes, trust me we need this!
|
||||||
columns_ = qMin(static_cast<int>(static_cast<double>(width() + 1) / (kWidth + 1)) + 1, kMaxColumns);
|
columns_ = qMin(static_cast<int>(static_cast<double>(width() + 1) / (kWidth + 1)) + 1, kMaxColumns);
|
||||||
rows_ = static_cast<uint>(static_cast<double>(height() + 1) / (kHeight + 1));
|
rows_ = static_cast<int>(static_cast<double>(height() + 1) / (kHeight + 1));
|
||||||
|
|
||||||
// this is the y-offset for drawing from the top of the widget
|
// this is the y-offset for drawing from the top of the widget
|
||||||
y_ = (height() - (rows_ * (kHeight + 1)) + 2) / 2;
|
y_ = (height() - (rows_ * (kHeight + 1)) + 2) / 2;
|
||||||
|
@ -88,9 +88,7 @@ void BlockAnalyzer::resizeEvent(QResizeEvent *e) {
|
||||||
if (rows_ != oldRows) {
|
if (rows_ != oldRows) {
|
||||||
barpixmap_ = QPixmap(kWidth, rows_ * (kHeight + 1));
|
barpixmap_ = QPixmap(kWidth, rows_ * (kHeight + 1));
|
||||||
|
|
||||||
for (uint i = 0; i < kFadeSize; ++i) {
|
std::fill(fade_bars_.begin(), fade_bars_.end(), QPixmap(kWidth, rows_ * (kHeight + 1)));
|
||||||
fade_bars_[i] = QPixmap(kWidth, rows_ * (kHeight + 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
yscale_.resize(rows_ + 1);
|
yscale_.resize(rows_ + 1);
|
||||||
|
|
||||||
|
@ -373,7 +371,7 @@ void BlockAnalyzer::paletteChange(const QPalette&) {
|
||||||
const int r2 = bg2.red(), g2 = bg2.green(), b2 = bg2.blue();
|
const int r2 = bg2.red(), g2 = bg2.green(), b2 = bg2.blue();
|
||||||
|
|
||||||
// Precalculate all fade-bar pixmaps
|
// Precalculate all fade-bar pixmaps
|
||||||
for (uint y = 0; y < kFadeSize; ++y) {
|
for (int y = 0; y < kFadeSize; ++y) {
|
||||||
fade_bars_[y].fill(palette().color(QPalette::Window));
|
fade_bars_[y].fill(palette().color(QPalette::Window));
|
||||||
QPainter f(&fade_bars_[y]);
|
QPainter f(&fade_bars_[y]);
|
||||||
for (int z = 0; z < rows_; ++z) {
|
for (int z = 0; z < rows_; ++z) {
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QtMath>
|
#include <QtMath>
|
||||||
|
|
||||||
FHT::FHT(int n) : num_((n < 3) ? 0 : 1 << n), exp2_((n < 3) ? -1 : n) {
|
FHT::FHT(uint n) : num_((n < 3) ? 0 : 1 << n), exp2_((n < 3) ? int(-1) : int(n)) {
|
||||||
|
|
||||||
if (n > 3) {
|
if (n > 3) {
|
||||||
buf_vector_.resize(num_);
|
buf_vector_.resize(num_);
|
||||||
|
|
|
@ -63,7 +63,7 @@ class FHT {
|
||||||
* should be at least 3. Values of more than 3 need a trigonometry table.
|
* should be at least 3. Values of more than 3 need a trigonometry table.
|
||||||
* @see makeCasTable()
|
* @see makeCasTable()
|
||||||
*/
|
*/
|
||||||
explicit FHT(int);
|
explicit FHT(uint);
|
||||||
|
|
||||||
~FHT();
|
~FHT();
|
||||||
int sizeExp() const;
|
int sizeExp() const;
|
||||||
|
|
|
@ -148,7 +148,7 @@ QString WordyTime(const quint64 seconds) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString WordyTimeNanosec(const qint64 nanoseconds) {
|
QString WordyTimeNanosec(const quint64 nanoseconds) {
|
||||||
return WordyTime(nanoseconds / kNsecPerSec);
|
return WordyTime(nanoseconds / kNsecPerSec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ QString PrettyTimeNanosec(const qint64 nanoseconds);
|
||||||
QString PrettySize(const quint64 bytes);
|
QString PrettySize(const quint64 bytes);
|
||||||
QString PrettySize(const QSize size);
|
QString PrettySize(const QSize size);
|
||||||
QString WordyTime(const quint64 seconds);
|
QString WordyTime(const quint64 seconds);
|
||||||
QString WordyTimeNanosec(const qint64 nanoseconds);
|
QString WordyTimeNanosec(const quint64 nanoseconds);
|
||||||
QString Ago(const qint64 seconds_since_epoch, const QLocale &locale);
|
QString Ago(const qint64 seconds_since_epoch, const QLocale &locale);
|
||||||
QString PrettyFutureDate(const QDate date);
|
QString PrettyFutureDate(const QDate date);
|
||||||
|
|
||||||
|
|
|
@ -482,9 +482,9 @@ void AlbumCoverChoiceController::ShowCover(const Song &song, const QPixmap &pixm
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 AlbumCoverChoiceController::SearchCoverAutomatically(const Song &song) {
|
quint64 AlbumCoverChoiceController::SearchCoverAutomatically(const Song &song) {
|
||||||
|
|
||||||
qint64 id = cover_fetcher_->FetchAlbumCover(song.effective_albumartist(), song.album(), song.title(), true);
|
quint64 id = cover_fetcher_->FetchAlbumCover(song.effective_albumartist(), song.album(), song.title(), true);
|
||||||
|
|
||||||
cover_fetching_tasks_[id] = song;
|
cover_fetching_tasks_[id] = song;
|
||||||
|
|
||||||
|
@ -640,12 +640,12 @@ void AlbumCoverChoiceController::SaveCoverEmbeddedAutomatic(const Song &song, co
|
||||||
urls.reserve(songs.count());
|
urls.reserve(songs.count());
|
||||||
for (const Song &s : songs) urls << s.url();
|
for (const Song &s : songs) urls << s.url();
|
||||||
if (result.is_jpeg()) {
|
if (result.is_jpeg()) {
|
||||||
qint64 id = app_->album_cover_loader()->SaveEmbeddedCoverAsync(urls, result.image_data);
|
quint64 id = app_->album_cover_loader()->SaveEmbeddedCoverAsync(urls, result.image_data);
|
||||||
QMutexLocker l(&mutex_cover_save_tasks_);
|
QMutexLocker l(&mutex_cover_save_tasks_);
|
||||||
cover_save_tasks_.insert(id, song);
|
cover_save_tasks_.insert(id, song);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qint64 id = app_->album_cover_loader()->SaveEmbeddedCoverAsync(urls, result.image);
|
quint64 id = app_->album_cover_loader()->SaveEmbeddedCoverAsync(urls, result.image);
|
||||||
QMutexLocker l(&mutex_cover_save_tasks_);
|
QMutexLocker l(&mutex_cover_save_tasks_);
|
||||||
cover_save_tasks_.insert(id, song);
|
cover_save_tasks_.insert(id, song);
|
||||||
}
|
}
|
||||||
|
@ -684,7 +684,7 @@ void AlbumCoverChoiceController::SaveCoverEmbeddedAutomatic(const Song &song, co
|
||||||
QList<QUrl> urls;
|
QList<QUrl> urls;
|
||||||
urls.reserve(songs.count());
|
urls.reserve(songs.count());
|
||||||
for (const Song &s : songs) urls << s.url();
|
for (const Song &s : songs) urls << s.url();
|
||||||
qint64 id = app_->album_cover_loader()->SaveEmbeddedCoverAsync(urls, cover_filename);
|
quint64 id = app_->album_cover_loader()->SaveEmbeddedCoverAsync(urls, cover_filename);
|
||||||
QMutexLocker l(&mutex_cover_save_tasks_);
|
QMutexLocker l(&mutex_cover_save_tasks_);
|
||||||
cover_save_tasks_.insert(id, song);
|
cover_save_tasks_.insert(id, song);
|
||||||
});
|
});
|
||||||
|
|
|
@ -129,7 +129,7 @@ class AlbumCoverChoiceController : public QWidget {
|
||||||
void ShowCover(const Song &song, const QPixmap &pixmap);
|
void ShowCover(const Song &song, const QPixmap &pixmap);
|
||||||
|
|
||||||
// Search for covers automatically
|
// Search for covers automatically
|
||||||
qint64 SearchCoverAutomatically(const Song &song);
|
quint64 SearchCoverAutomatically(const Song &song);
|
||||||
|
|
||||||
// Saves the chosen cover as manual cover path of this song in collection.
|
// Saves the chosen cover as manual cover path of this song in collection.
|
||||||
void SaveArtAutomaticToSong(Song *song, const QUrl &art_automatic);
|
void SaveArtAutomaticToSong(Song *song, const QUrl &art_automatic);
|
||||||
|
@ -185,7 +185,7 @@ class AlbumCoverChoiceController : public QWidget {
|
||||||
QAction *search_cover_auto_;
|
QAction *search_cover_auto_;
|
||||||
|
|
||||||
QMap<quint64, Song> cover_fetching_tasks_;
|
QMap<quint64, Song> cover_fetching_tasks_;
|
||||||
QMap<qint64, Song> cover_save_tasks_;
|
QMap<quint64, Song> cover_save_tasks_;
|
||||||
QMutex mutex_cover_save_tasks_;
|
QMutex mutex_cover_save_tasks_;
|
||||||
|
|
||||||
CollectionSettingsPage::SaveCoverType save_cover_type_;
|
CollectionSettingsPage::SaveCoverType save_cover_type_;
|
||||||
|
|
|
@ -75,7 +75,7 @@ AlbumCoverFetcherSearch::~AlbumCoverFetcherSearch() {
|
||||||
void AlbumCoverFetcherSearch::TerminateSearch() {
|
void AlbumCoverFetcherSearch::TerminateSearch() {
|
||||||
|
|
||||||
QList<int> ids = pending_requests_.keys();
|
QList<int> ids = pending_requests_.keys();
|
||||||
for (const quint64 id : ids) {
|
for (const int id : ids) {
|
||||||
pending_requests_.take(id)->CancelSearch(id);
|
pending_requests_.take(id)->CancelSearch(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -380,7 +380,7 @@ float AlbumCoverFetcherSearch::ScoreImage(const QSize size) {
|
||||||
const float size_score = std::sqrt(float(size.width() * size.height())) / kTargetSize;
|
const float size_score = std::sqrt(float(size.width() * size.height())) / kTargetSize;
|
||||||
|
|
||||||
// A 1:1 image scores 1.0, anything else scores less
|
// A 1:1 image scores 1.0, anything else scores less
|
||||||
const float aspect_score = float(1.0) - float(std::max(size.width(), size.height()) - std::min(size.width(), size.height())) / std::max(size.height(), size.width());
|
const float aspect_score = float(1.0) - float(std::max(size.width(), size.height()) - std::min(size.width(), size.height())) / float(std::max(size.height(), size.width()));
|
||||||
|
|
||||||
return size_score + aspect_score;
|
return size_score + aspect_score;
|
||||||
|
|
||||||
|
|
|
@ -545,55 +545,55 @@ void AlbumCoverLoader::RemoteFetchFinished(QNetworkReply *reply, const QUrl &cov
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QString &song_filename, const QString &cover_filename) {
|
quint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QString &song_filename, const QString &cover_filename) {
|
||||||
|
|
||||||
QMutexLocker l(&mutex_save_image_async_);
|
QMutexLocker l(&mutex_save_image_async_);
|
||||||
qint64 id = ++save_image_async_id_;
|
quint64 id = ++save_image_async_id_;
|
||||||
QMetaObject::invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QString, song_filename), Q_ARG(QString, cover_filename));
|
QMetaObject::invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QString, song_filename), Q_ARG(QString, cover_filename));
|
||||||
return id;
|
return id;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QString &song_filename, const QImage &image) {
|
quint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QString &song_filename, const QImage &image) {
|
||||||
|
|
||||||
QMutexLocker l(&mutex_save_image_async_);
|
QMutexLocker l(&mutex_save_image_async_);
|
||||||
qint64 id = ++save_image_async_id_;
|
quint64 id = ++save_image_async_id_;
|
||||||
QMetaObject::invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QString, song_filename), Q_ARG(QImage, image));
|
QMetaObject::invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QString, song_filename), Q_ARG(QImage, image));
|
||||||
return id;
|
return id;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QString &song_filename, const QByteArray &image_data) {
|
quint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QString &song_filename, const QByteArray &image_data) {
|
||||||
|
|
||||||
QMutexLocker l(&mutex_save_image_async_);
|
QMutexLocker l(&mutex_save_image_async_);
|
||||||
qint64 id = ++save_image_async_id_;
|
quint64 id = ++save_image_async_id_;
|
||||||
QMetaObject::invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QString, song_filename), Q_ARG(QByteArray, image_data));
|
QMetaObject::invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QString, song_filename), Q_ARG(QByteArray, image_data));
|
||||||
return id;
|
return id;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const QString &cover_filename) {
|
quint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const QString &cover_filename) {
|
||||||
|
|
||||||
QMutexLocker l(&mutex_save_image_async_);
|
QMutexLocker l(&mutex_save_image_async_);
|
||||||
qint64 id = ++save_image_async_id_;
|
quint64 id = ++save_image_async_id_;
|
||||||
QMetaObject::invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QList<QUrl>, urls), Q_ARG(QString, cover_filename));
|
QMetaObject::invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QList<QUrl>, urls), Q_ARG(QString, cover_filename));
|
||||||
return id;
|
return id;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const QImage &image) {
|
quint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const QImage &image) {
|
||||||
|
|
||||||
QMutexLocker l(&mutex_save_image_async_);
|
QMutexLocker l(&mutex_save_image_async_);
|
||||||
qint64 id = ++save_image_async_id_;
|
quint64 id = ++save_image_async_id_;
|
||||||
QMetaObject::invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QList<QUrl>, urls), Q_ARG(QImage, image));
|
QMetaObject::invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QList<QUrl>, urls), Q_ARG(QImage, image));
|
||||||
return id;
|
return id;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const QByteArray &image_data) {
|
quint64 AlbumCoverLoader::SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const QByteArray &image_data) {
|
||||||
|
|
||||||
QMutexLocker l(&mutex_save_image_async_);
|
QMutexLocker l(&mutex_save_image_async_);
|
||||||
qint64 id = ++save_image_async_id_;
|
quint64 id = ++save_image_async_id_;
|
||||||
QMetaObject::invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QList<QUrl>, urls), Q_ARG(QByteArray, image_data));
|
QMetaObject::invokeMethod(this, "SaveEmbeddedCover", Qt::QueuedConnection, Q_ARG(qint64, id), Q_ARG(QList<QUrl>, urls), Q_ARG(QByteArray, image_data));
|
||||||
return id;
|
return id;
|
||||||
|
|
||||||
|
|
|
@ -81,12 +81,12 @@ class AlbumCoverLoader : public QObject {
|
||||||
void CancelTask(const quint64 id);
|
void CancelTask(const quint64 id);
|
||||||
void CancelTasks(const QSet<quint64> &ids);
|
void CancelTasks(const QSet<quint64> &ids);
|
||||||
|
|
||||||
qint64 SaveEmbeddedCoverAsync(const QString &song_filename, const QString &cover_filename);
|
quint64 SaveEmbeddedCoverAsync(const QString &song_filename, const QString &cover_filename);
|
||||||
qint64 SaveEmbeddedCoverAsync(const QString &song_filename, const QImage &image);
|
quint64 SaveEmbeddedCoverAsync(const QString &song_filename, const QImage &image);
|
||||||
qint64 SaveEmbeddedCoverAsync(const QString &song_filename, const QByteArray &image_data);
|
quint64 SaveEmbeddedCoverAsync(const QString &song_filename, const QByteArray &image_data);
|
||||||
qint64 SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const QString &cover_filename);
|
quint64 SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const QString &cover_filename);
|
||||||
qint64 SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const QImage &image);
|
quint64 SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const QImage &image);
|
||||||
qint64 SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const QByteArray &image_data);
|
quint64 SaveEmbeddedCoverAsync(const QList<QUrl> &urls, const QByteArray &image_data);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void ExitFinished();
|
void ExitFinished();
|
||||||
|
|
|
@ -214,7 +214,7 @@ class AlbumCoverManager : public QMainWindow {
|
||||||
QPushButton *abort_progress_;
|
QPushButton *abort_progress_;
|
||||||
int jobs_;
|
int jobs_;
|
||||||
|
|
||||||
QMultiMap<qint64, AlbumItem*> cover_save_tasks_;
|
QMultiMap<quint64, AlbumItem*> cover_save_tasks_;
|
||||||
QList<AlbumItem*> cover_save_tasks2_;
|
QList<AlbumItem*> cover_save_tasks2_;
|
||||||
|
|
||||||
QListWidgetItem *all_artists_;
|
QListWidgetItem *all_artists_;
|
||||||
|
|
|
@ -229,7 +229,7 @@ QByteArray DiscogsCoverProvider::GetReplyData(QNetworkReply *reply) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiscogsCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id) {
|
void DiscogsCoverProvider::HandleSearchReply(QNetworkReply *reply, const quint64 id) {
|
||||||
|
|
||||||
if (!replies_.contains(reply)) return;
|
if (!replies_.contains(reply)) return;
|
||||||
replies_.removeAll(reply);
|
replies_.removeAll(reply);
|
||||||
|
@ -285,7 +285,7 @@ void DiscogsCoverProvider::HandleSearchReply(QNetworkReply *reply, const int id)
|
||||||
Error("Invalid Json reply, results value object is missing ID, title or resource_url.", obj_result);
|
Error("Invalid Json reply, results value object is missing ID, title or resource_url.", obj_result);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
quint64 release_id = obj_result["id"].toDouble();
|
quint64 release_id = obj_result["id"].toInt();
|
||||||
QUrl resource_url(obj_result["resource_url"].toString());
|
QUrl resource_url(obj_result["resource_url"].toString());
|
||||||
QString title = obj_result["title"].toString();
|
QString title = obj_result["title"].toString();
|
||||||
|
|
||||||
|
@ -336,7 +336,7 @@ void DiscogsCoverProvider::SendReleaseRequest(const DiscogsCoverReleaseContext &
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiscogsCoverProvider::HandleReleaseReply(QNetworkReply *reply, const int search_id, const quint64 release_id) {
|
void DiscogsCoverProvider::HandleReleaseReply(QNetworkReply *reply, const quint64 search_id, const quint64 release_id) {
|
||||||
|
|
||||||
if (!replies_.contains(reply)) return;
|
if (!replies_.contains(reply)) return;
|
||||||
replies_.removeAll(reply);
|
replies_.removeAll(reply);
|
||||||
|
@ -440,7 +440,7 @@ void DiscogsCoverProvider::HandleReleaseReply(QNetworkReply *reply, const int se
|
||||||
int width = obj_image["width"].toInt();
|
int width = obj_image["width"].toInt();
|
||||||
int height = obj_image["height"].toInt();
|
int height = obj_image["height"].toInt();
|
||||||
if (width < 300 || height < 300) continue;
|
if (width < 300 || height < 300) continue;
|
||||||
const float aspect_score = float(1.0) - float(std::max(width, height) - std::min(width, height)) / std::max(height, width);
|
const float aspect_score = float(1.0) - float(std::max(width, height) - std::min(width, height)) / float(std::max(height, width));
|
||||||
if (aspect_score < 0.85) continue;
|
if (aspect_score < 0.85) continue;
|
||||||
CoverProviderSearchResult result;
|
CoverProviderSearchResult result;
|
||||||
result.artist = artist;
|
result.artist = artist;
|
||||||
|
|
|
@ -90,8 +90,8 @@ class DiscogsCoverProvider : public JsonCoverProvider {
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void FlushRequests();
|
void FlushRequests();
|
||||||
void HandleSearchReply(QNetworkReply *reply, const int id);
|
void HandleSearchReply(QNetworkReply *reply, const quint64 id);
|
||||||
void HandleReleaseReply(QNetworkReply *reply, const int id, const quint64 release_id);
|
void HandleReleaseReply(QNetworkReply *reply, const quint64 id, const quint64 release_id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const char *kUrlSearch;
|
static const char *kUrlSearch;
|
||||||
|
|
|
@ -80,7 +80,7 @@ SpotifyCoverProvider::SpotifyCoverProvider(Application *app, NetworkAccessManage
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
if (!refresh_token_.isEmpty()) {
|
if (!refresh_token_.isEmpty()) {
|
||||||
qint64 time = expires_in_ - (QDateTime::currentDateTime().toSecsSinceEpoch() - login_time_);
|
quint64 time = expires_in_ - (QDateTime::currentDateTime().toSecsSinceEpoch() - login_time_);
|
||||||
if (time < 1) time = 1;
|
if (time < 1) time = 1;
|
||||||
refresh_login_timer_.setInterval(static_cast<int>(time * kMsecPerSec));
|
refresh_login_timer_.setInterval(static_cast<int>(time * kMsecPerSec));
|
||||||
refresh_login_timer_.start();
|
refresh_login_timer_.start();
|
||||||
|
|
|
@ -187,9 +187,9 @@ QByteArray MoodbarBuilder::Finish(int width) {
|
||||||
|
|
||||||
const int n = end - start;
|
const int n = end - start;
|
||||||
|
|
||||||
*(data++) = rgb.r / n;
|
*(data++) = char(rgb.r / n);
|
||||||
*(data++) = rgb.g / n;
|
*(data++) = char(rgb.g / n);
|
||||||
*(data++) = rgb.b / n;
|
*(data++) = char(rgb.b / n);
|
||||||
|
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -164,7 +164,7 @@ void OSDDBus::ShowMessageNative(const QString &summary, const QString &message,
|
||||||
|
|
||||||
hints["transient"] = QVariant(true);
|
hints["transient"] = QVariant(true);
|
||||||
|
|
||||||
int id = 0;
|
quint64 id = 0;
|
||||||
if (last_notification_time_.secsTo(QDateTime::currentDateTime()) * 1000 < timeout_msec()) {
|
if (last_notification_time_.secsTo(QDateTime::currentDateTime()) * 1000 < timeout_msec()) {
|
||||||
// Reuse the existing popup if it's still open. The reason we don't always
|
// Reuse the existing popup if it's still open. The reason we don't always
|
||||||
// reuse the popup is because the notification daemon on KDE4 won't re-show the bubble if it's already gone to the tray. See issue #118
|
// reuse the popup is because the notification daemon on KDE4 won't re-show the bubble if it's already gone to the tray. See issue #118
|
||||||
|
|
|
@ -145,7 +145,7 @@ class OSDPretty : public QWidget {
|
||||||
// Settings loaded from QSettings
|
// Settings loaded from QSettings
|
||||||
QColor foreground_color_;
|
QColor foreground_color_;
|
||||||
QColor background_color_;
|
QColor background_color_;
|
||||||
float background_opacity_;
|
qreal background_opacity_;
|
||||||
QString popup_screen_name_;
|
QString popup_screen_name_;
|
||||||
QPoint popup_pos_;
|
QPoint popup_pos_;
|
||||||
QScreen *popup_screen_;
|
QScreen *popup_screen_;
|
||||||
|
|
|
@ -224,7 +224,7 @@ void QobuzStreamURLRequest::StreamURLReceived() {
|
||||||
|
|
||||||
qint64 duration = -1;
|
qint64 duration = -1;
|
||||||
if (json_obj.contains("duration")) {
|
if (json_obj.contains("duration")) {
|
||||||
duration = json_obj["duration"].toDouble() * kNsecPerSec;
|
duration = json_obj["duration"].toInt() * kNsecPerSec;
|
||||||
}
|
}
|
||||||
int samplerate = -1;
|
int samplerate = -1;
|
||||||
if (json_obj.contains("sampling_rate")) {
|
if (json_obj.contains("sampling_rate")) {
|
||||||
|
|
Loading…
Reference in New Issue