aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/General
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/General')
-rw-r--r--src/plugins/General/converter/converterdialog.cpp2
-rw-r--r--src/plugins/General/converter/converterdialog.h2
-rw-r--r--src/plugins/General/copypaste/copypaste.cpp2
-rw-r--r--src/plugins/General/fileops/fileops.cpp2
-rw-r--r--src/plugins/General/hal/halplugin.cpp17
-rw-r--r--src/plugins/General/scrobbler/scrobbler.cpp5
-rw-r--r--src/plugins/General/streambrowser/streamwindow.cpp8
-rw-r--r--src/plugins/General/udisks2/udisks2device.cpp2
-rw-r--r--src/plugins/General/udisks2/udisks2plugin.cpp15
9 files changed, 33 insertions, 22 deletions
diff --git a/src/plugins/General/converter/converterdialog.cpp b/src/plugins/General/converter/converterdialog.cpp
index 90de6aca1..f6e1fe6ee 100644
--- a/src/plugins/General/converter/converterdialog.cpp
+++ b/src/plugins/General/converter/converterdialog.cpp
@@ -36,7 +36,7 @@
#include "preseteditor.h"
#include "converterdialog.h"
-ConverterDialog::ConverterDialog(QList <PlayListTrack *> tracks, QWidget *parent) : QDialog(parent)
+ConverterDialog::ConverterDialog(const QList <PlayListTrack *> &tracks, QWidget *parent) : QDialog(parent)
{
m_ui.setupUi(this);
m_ui.tableWidget->verticalHeader()->setDefaultSectionSize(fontMetrics().height() + 3);
diff --git a/src/plugins/General/converter/converterdialog.h b/src/plugins/General/converter/converterdialog.h
index e1d7dd2c1..89eeaa0e8 100644
--- a/src/plugins/General/converter/converterdialog.h
+++ b/src/plugins/General/converter/converterdialog.h
@@ -37,7 +37,7 @@ class ConverterDialog : public QDialog
{
Q_OBJECT
public:
- explicit ConverterDialog(QList <PlayListTrack *> items, QWidget *parent = nullptr);
+ explicit ConverterDialog(const QList<PlayListTrack *> &items, QWidget *parent = nullptr);
virtual ~ConverterDialog();
public slots:
diff --git a/src/plugins/General/copypaste/copypaste.cpp b/src/plugins/General/copypaste/copypaste.cpp
index c2ef73565..183c5be5a 100644
--- a/src/plugins/General/copypaste/copypaste.cpp
+++ b/src/plugins/General/copypaste/copypaste.cpp
@@ -86,7 +86,7 @@ void CopyPaste::copy()
void CopyPaste::paste()
{
qDebug("%s", Q_FUNC_INFO);
- for(const PlayListTrack *track : qAsConst( m_buffer))
+ for(const PlayListTrack *track : qAsConst(m_buffer))
{
m_pl_manager->selectedPlayList()->add(new PlayListTrack(*track));
}
diff --git a/src/plugins/General/fileops/fileops.cpp b/src/plugins/General/fileops/fileops.cpp
index a6478438b..5789bd906 100644
--- a/src/plugins/General/fileops/fileops.cpp
+++ b/src/plugins/General/fileops/fileops.cpp
@@ -82,7 +82,7 @@ void FileOps::execAction(int n)
QString destination = m_destinations.at(n);
PlayListModel *model = MediaPlayer::instance()->playListManager()->selectedPlayList();
- QList<PlayListTrack*> tracks = model->selectedTracks();
+ const QList<PlayListTrack*> tracks = model->selectedTracks();
switch (type)
{
diff --git a/src/plugins/General/hal/halplugin.cpp b/src/plugins/General/hal/halplugin.cpp
index ca1e0952a..092bd02fa 100644
--- a/src/plugins/General/hal/halplugin.cpp
+++ b/src/plugins/General/hal/halplugin.cpp
@@ -46,9 +46,9 @@ HalPlugin::HalPlugin(QObject *parent) : QObject(parent)
m_addTracks = false; //do not load tracks on startup
m_addFiles = false;
//find existing devices
- QStringList udis = m_manager->findDeviceByCapability("volume");
+ const QStringList udis = m_manager->findDeviceByCapability("volume");
for(const QString &udi : qAsConst(udis))
- addDevice(udi);
+ addDevice(udi);
//load remaining settings
m_addTracks = settings.value("add_tracks", false).toBool();
m_removeTracks = settings.value("remove_tracks", false).toBool();
@@ -63,16 +63,21 @@ HalPlugin::~HalPlugin()
void HalPlugin::removeDevice(const QString &udi)
{
- for(HalDevice *device : qAsConst(m_devices))
+ QList<HalDevice *>::iterator it = m_devices.begin();
+ while(it != m_devices.end())
{
- if (device->udi() == udi)
+ if((*it)->udi() == udi)
{
- m_devices.removeAll(device);
- delete device;
+ delete *it;
+ it = m_devices.erase(it);
qDebug("HalPlugin: device \"%s\" removed", qPrintable(udi));
updateActions();
break;
}
+ else
+ {
+ ++it;
+ }
}
}
diff --git a/src/plugins/General/scrobbler/scrobbler.cpp b/src/plugins/General/scrobbler/scrobbler.cpp
index 510f2e6aa..0a8b114f4 100644
--- a/src/plugins/General/scrobbler/scrobbler.cpp
+++ b/src/plugins/General/scrobbler/scrobbler.cpp
@@ -297,7 +297,7 @@ void Scrobbler::submit()
params.insert("method", "track.scrobble");
params.insert("sk", m_session);
- QStringList keys = params.keys();
+ const QStringList keys = params.keys();
for(const QString &key : qAsConst(keys)) //removes empty keys
{
if(params.value(key).isEmpty() || params.value(key) == "0")
@@ -347,7 +347,8 @@ void Scrobbler::sendNotification(const SongInfo &info)
params.insert("method", "track.updateNowPlaying");
params.insert("sk", m_session);
- for(const QString &key : qAsConst(params)) //removes empty keys
+ const QStringList keys = params.keys();
+ for(const QString &key : qAsConst(keys)) //removes empty keys
{
if(params.value(key).isEmpty())
params.remove(key);
diff --git a/src/plugins/General/streambrowser/streamwindow.cpp b/src/plugins/General/streambrowser/streamwindow.cpp
index d668068d4..fa90b8ec2 100644
--- a/src/plugins/General/streambrowser/streamwindow.cpp
+++ b/src/plugins/General/streambrowser/streamwindow.cpp
@@ -184,7 +184,7 @@ void StreamWindow::on_addPushButton_clicked()
QList<PlayListTrack *> tracks;
if(m_ui->tabWidget->currentIndex() == 0)
{
- QModelIndexList indexes = m_ui->favoritesTableView->selectionModel()->selectedRows(0);
+ const QModelIndexList indexes = m_ui->favoritesTableView->selectionModel()->selectedRows(0);
for(const QModelIndex &index : qAsConst(indexes))
{
QModelIndex source_index = m_favoritesFilterModel->mapToSource(index);
@@ -197,7 +197,7 @@ void StreamWindow::on_addPushButton_clicked()
}
else
{
- QModelIndexList indexes = m_ui->icecastTableView->selectionModel()->selectedRows(0);
+ const QModelIndexList indexes = m_ui->icecastTableView->selectionModel()->selectedRows(0);
for(const QModelIndex &index : qAsConst(indexes))
{
QModelIndex source_index = m_iceCastFilterModel->mapToSource(index);
@@ -234,7 +234,7 @@ void StreamWindow::execFavoritesMenu(const QPoint &pos)
void StreamWindow::addToFavorites()
{
- QModelIndexList indexes = m_ui->icecastTableView->selectionModel()->selectedRows(0);
+ const QModelIndexList indexes = m_ui->icecastTableView->selectionModel()->selectedRows(0);
for(const QModelIndex &index : qAsConst(indexes))
{
QModelIndex source_index = m_iceCastFilterModel->mapToSource(index);
@@ -307,7 +307,7 @@ void StreamWindow::removeFromFavorites()
{
if(m_ui->tabWidget->currentIndex() != 0)
return;
- QModelIndexList indexes = m_ui->favoritesTableView->selectionModel()->selectedRows(0);
+ const QModelIndexList indexes = m_ui->favoritesTableView->selectionModel()->selectedRows(0);
QList<int> rows_to_remove;
for(const QModelIndex &index : qAsConst(indexes))
{
diff --git a/src/plugins/General/udisks2/udisks2device.cpp b/src/plugins/General/udisks2/udisks2device.cpp
index e30ae16dd..52873c5e0 100644
--- a/src/plugins/General/udisks2/udisks2device.cpp
+++ b/src/plugins/General/udisks2/udisks2device.cpp
@@ -88,7 +88,7 @@ QStringList UDisks2Device::mountPoints() const
QDBusMessage reply = QDBusConnection::systemBus().call(message);
- QList<QVariant> args = reply.arguments();
+ const QList<QVariant> args = reply.arguments();
for(const QVariant &arg : qAsConst(args))
{
diff --git a/src/plugins/General/udisks2/udisks2plugin.cpp b/src/plugins/General/udisks2/udisks2plugin.cpp
index d249c06b0..65ad8ea2f 100644
--- a/src/plugins/General/udisks2/udisks2plugin.cpp
+++ b/src/plugins/General/udisks2/udisks2plugin.cpp
@@ -48,7 +48,7 @@ UDisks2Plugin::UDisks2Plugin(QObject *parent) : QObject(parent)
m_addTracks = false; //do not load tracks on startup
m_addFiles = false;
//find existing devices
- QList<QDBusObjectPath> devs = m_manager->findAllDevices();
+ const QList<QDBusObjectPath> devs = m_manager->findAllDevices();
for(const QDBusObjectPath &o : qAsConst(devs))
addDevice(o);
//load remaining settings
@@ -65,16 +65,21 @@ UDisks2Plugin::~UDisks2Plugin()
void UDisks2Plugin::removeDevice(QDBusObjectPath o)
{
- for(UDisks2Device *device : qAsConst(m_devices))
+ QList<UDisks2Device *>::iterator it = m_devices.begin();
+ while(it != m_devices.end())
{
- if (device->objectPath() == o)
+ if((*it)->objectPath() == o)
{
- m_devices.removeAll(device);
- delete device;
+ delete (*it);
+ it = m_devices.erase(it);
qDebug("UDisks2Plugin: removed device: \"%s\"", qPrintable(o.path()));
updateActions();
break;
}
+ else
+ {
+ ++it;
+ }
}
}