Commit 25d4fa7c authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Make it compile against qt5.15 without deprecated method

parent ce7108fe
Pipeline #13605 passed with stage
in 20 minutes and 40 seconds
......@@ -113,7 +113,11 @@ void LyricsWidget::showEvent(QShowEvent *)
void LyricsWidget::receiveListReply(QNetworkReply* reply)
{
disconnect(m_networkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(receiveListReply(QNetworkReply*)));
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
if (reply->error() != QNetworkReply::NoError) {
#else
if (reply->networkError() != QNetworkReply::NoError) {
#endif
qCWarning(JUK_LOG) << "Error while fetching lyrics: " << reply->errorString();
setHtml(i18n("<span style='color:red'>Error while retrieving lyrics!</span>"));
return;
......@@ -142,7 +146,11 @@ void LyricsWidget::receiveListReply(QNetworkReply* reply)
void LyricsWidget::receiveLyricsReply(QNetworkReply* reply)
{
disconnect(m_networkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(receiveLyricsReply(QNetworkReply*)));
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
if (reply->error() != QNetworkReply::NoError) {
#else
if (reply->networkError() != QNetworkReply::NoError) {
#endif
qCWarning(JUK_LOG) << "Error while fetching lyrics: " << reply->errorString();
setHtml(i18n("<span style='color:red'>Error while retrieving lyrics!</span>"));
return;
......
......@@ -122,7 +122,9 @@ CoverItem::CoverItem(NowPlaying *parent) :
NowPlayingItem(parent)
{
setObjectName(QLatin1String("CoverItem"));
setFixedHeight(parent->height() - parent->layout()->margin() * 2);
const QMargins margins = parent->layout()->contentsMargins();
setFixedHeight(parent->height() - (margins.top() + margins.bottom()));
setContentsMargins(1, 1, 1, 1);
setAcceptDrops(true);
}
......@@ -249,7 +251,8 @@ TrackItem::TrackItem(NowPlaying *parent) :
NowPlayingItem(parent)
{
setObjectName(QLatin1String("TrackItem"));
setFixedHeight(parent->height() - parent->layout()->margin() * 2);
const QMargins margins = parent->layout()->contentsMargins();
setFixedHeight(parent->height() - (margins.top() + margins.bottom()));
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
QVBoxLayout *layout = new QVBoxLayout(this);
......
......@@ -280,7 +280,7 @@ void Playlist::save()
QStringList fileList = files();
foreach(const QString &file, fileList)
stream << file << endl;
stream << file << '\n';
file.close();
}
......@@ -551,7 +551,7 @@ void Playlist::slotAddCover(bool retrieveLocal)
this, i18n("Select Cover Image File"),
QUrl::fromLocalFile(QDir::home().path()),
i18n("Images (*.png *.jpg)"), nullptr,
0, QStringList() << QStringLiteral("file")
{}, QStringList() << QStringLiteral("file")
);
if(file.isEmpty())
return;
......
......@@ -187,7 +187,11 @@ void Scrobbler::handleAuthenticationReply()
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
qCDebug(JUK_LOG) << "got authentication reply";
if(reply->error() != QNetworkReply::NoError) {
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
if (reply->error() != QNetworkReply::NoError) {
#else
if (reply->networkError() != QNetworkReply::NoError) {
#endif
emit invalidAuth();
qCWarning(JUK_LOG) << "Error while getting authentication reply" << reply->errorString();
return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment