Commit 288c69eb authored by Michael Pyne's avatar Michael Pyne
Browse files

clazy: Fix most remaining warnings.

I'm not going to worry about non-POD statics in an application, and I
can't fix the Q_PROPERTY warnings in Phonon. Other than that, all
default clazy warnings should be gone now.

Of note is the tagtransactionmanager.cpp setFile call, which is not just
a warning but an actual bug (good job clazy!).
parent f1fbb54a
Pipeline #51901 passed with stage
in 10 minutes and 31 seconds
......@@ -160,7 +160,6 @@ void DirectoryList::slotRemoveExcludeDirectory()
// These will be used in the loop below
QModelIndexList indexes;
QModelIndex firstIndex;
QString dir;
// The multiple indexes that are possibly present cannot be deleted one
// after the other, as changing the layout of the model can change the
......
......@@ -87,7 +87,7 @@ void ExampleOptionsDialog::showEvent(QShowEvent *)
void ExampleOptionsDialog::fileModeSelected()
{
emit urlChanged(m_options->m_exampleFile->url());
urlChanged(m_options->m_exampleFile->url());
}
// vim: set et sw=4 tw=0 sta:
......@@ -137,7 +137,7 @@ JuK::JuK(const QStringList &filesToOpen, QWidget *parent) :
QStringLiteral("org.freedesktop.PowerManagement.Inhibit"),
QDBusConnection::sessionBus());
connect(m_player, &PlayerManager::signalPlay, [=] () {
connect(m_player, &PlayerManager::signalPlay, pmInterface, [=] () {
QDBusReply<uint> reply;
if (pmInterface->isValid() && (m_pmToken == 0)) {
reply = pmInterface->call(QStringLiteral("Inhibit"),
......
......@@ -63,7 +63,7 @@ int main(int argc, char *argv[])
KAboutData aboutData(QStringLiteral("juk"), i18n("JuK"),
QStringLiteral(JUK_VERSION), i18n(description), KAboutLicense::GPL,
i18n("Copyright © 2002–2021, Scott Wheeler, Michael Pyne, and others"),
QStringLiteral(""),
QLatin1String(""),
QStringLiteral("https://juk.kde.org/"));
aboutData.addAuthor(i18n("Scott Wheeler"), i18n(scott), "wheeler@kde.org");
......
......@@ -225,8 +225,6 @@ void CoverItem::dropEvent(QDropEvent *e)
if(urls.isEmpty())
return;
QString fileName;
auto getJob = KIO::storedGet(urls.front());
KJobWidgets::setWindow(getJob, this);
if(getJob->exec()) {
......@@ -302,10 +300,10 @@ void TrackItem::slotUpdate()
return;
}
QString title = m_file.tag()->title().toHtmlEscaped();
QString artist = m_file.tag()->artist().toHtmlEscaped();
QString album = m_file.tag()->album().toHtmlEscaped();
QString separator =
const QString title = m_file.tag()->title().toHtmlEscaped();
const QString artist = m_file.tag()->artist().toHtmlEscaped();
const QString album = m_file.tag()->album().toHtmlEscaped();
const QString separator =
(artist.isEmpty() || album.isEmpty())
? QString() : QString(" - ");
......@@ -326,7 +324,7 @@ void TrackItem::slotUpdate()
do {
m_label->setText(format.arg(size).arg(title).arg(size - 2)
.arg(artist).arg(separator).arg(album));
.arg(artist, separator, album));
--size;
neededHeight = m_label->heightForWidth(m_label->width());
} while(neededHeight > parentHeight && size >= -1);
......
......@@ -51,6 +51,7 @@
#include <QDropEvent>
#include <QDragEnterEvent>
#include <QPixmap>
#include <QSet>
#include <QStackedWidget>
#include <QScrollBar>
#include <QPainter>
......@@ -154,7 +155,7 @@ Playlist::Playlist(PlaylistCollection *collection, const QFileInfo &playlistFile
// Load the file after construction completes so that virtual methods in
// subclasses can take effect.
QTimer::singleShot(0, [=]() {
QTimer::singleShot(0, this, [=]() {
loadFile(m_fileName, playlistFile);
collection->setupPlaylist(this, iconName);
});
......@@ -1073,25 +1074,22 @@ void Playlist::addFiles(const QStringList &files, PlaylistItem *after)
void Playlist::refreshAlbums(const PlaylistItemList &items, coverKey id)
{
QList< QPair<QString, QString> > albums;
QSet<QPair<QString, QString>> albums;
bool setAlbumCovers = items.count() == 1;
foreach(const PlaylistItem *item, items) {
QString artist = item->file().tag()->artist();
QString album = item->file().tag()->album();
for(const auto &item : items) {
const QString artist = item->file().tag()->artist();
const QString album = item->file().tag()->album();
if(!albums.contains(qMakePair(artist, album)))
albums.append(qMakePair(artist, album));
albums.insert(qMakePair(artist, album));
item->file().coverInfo()->setCoverId(id);
if(setAlbumCovers)
item->file().coverInfo()->applyCoverToWholeAlbum(true);
}
for(QList< QPair<QString, QString> >::ConstIterator it = albums.constBegin();
it != albums.constEnd(); ++it)
{
refreshAlbum((*it).first, (*it).second);
for(const auto &albumPair : qAsConst(albums)) {
refreshAlbum(albumPair.first, albumPair.second);
}
}
......
......@@ -372,15 +372,14 @@ void PlaylistBox::remove()
QStringList names;
foreach(Item *item, items) {
if(item && item->playlist())
{
if (!item->playlist()->fileName().isEmpty() &&
QFileInfo(item->playlist()->fileName()).exists())
{
files.append(item->playlist()->fileName());
}
if(item && item->playlist()) {
if (!item->playlist()->fileName().isEmpty() &&
QFileInfo::exists(item->playlist()->fileName()))
{
files.append(item->playlist()->fileName());
}
names.append(item->playlist()->name());
names.append(item->playlist()->name());
}
}
......
......@@ -456,7 +456,7 @@ void PlaylistCollection::editSearch()
auto searchDialog = new AdvancedSearchDialog(
p->name(), *(p->playlistSearch()), JuK::JuKInstance());
QObject::connect(searchDialog, &QDialog::finished, [searchDialog, p](int result)
QObject::connect(searchDialog, &QDialog::finished, p, [searchDialog, p](int result)
{
if (result) {
p->setPlaylistSearch(searchDialog->resultSearch());
......@@ -533,7 +533,7 @@ void PlaylistCollection::createSearchPlaylist()
auto searchDialog = new AdvancedSearchDialog(
name, *(new PlaylistSearch(JuK::JuKInstance())), JuK::JuKInstance());
QObject::connect(searchDialog, &QDialog::finished, [searchDialog, this](int result)
QObject::connect(searchDialog, &QDialog::finished, object(), [searchDialog, this](int result)
{
if (result) {
raise(new SearchPlaylist(
......
......@@ -139,12 +139,13 @@ void Scrobbler::getAuthToken(QString username, QString password)
params["authToken"] = authToken;
params["username"] = username;
QUrl url("http://ws.audioscrobbler.com/2.0/?");
QUrl url("https://ws.audioscrobbler.com/2.0/?");
sign(params);
QUrlQuery urlQuery;
foreach(QString key, params.keys()) {
const auto paramKeys = params.keys();
for(const auto &key : paramKeys) {
urlQuery.addQueryItem(key, params[key]);
}
......@@ -302,10 +303,11 @@ void Scrobbler::scrobble()
void Scrobbler::post(QMap<QString, QString> &params)
{
QUrl url("http://ws.audioscrobbler.com/2.0/");
QUrl url("https://ws.audioscrobbler.com/2.0/");
QByteArray data;
foreach(QString key, params.keys()) {
const auto paramKeys = params.keys();
for(const auto &key : paramKeys) {
data += QUrl::toPercentEncoding(key) + '=' + QUrl::toPercentEncoding(params[key]) + '&';
}
......
......@@ -147,7 +147,7 @@ bool TagTransactionManager::processChangeList(bool undo)
if(!undo)
m_undoList.emplace_back(item, duplicateTag(item->file().tag()));
item->file().setFile(tag->fileName());
item->setFile(tag->fileName());
item->refreshFromDisk();
//FIXME repaint
//item->repaint();
......
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