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.cpp6
-rw-r--r--src/plugins/General/copypaste/copypaste.cpp6
-rw-r--r--src/plugins/General/covermanager/coverwidget.cpp2
-rw-r--r--src/plugins/General/fileops/fileops.cpp12
-rw-r--r--src/plugins/General/fileops/fileops.h4
-rw-r--r--src/plugins/General/hal/halplugin.cpp18
-rw-r--r--src/plugins/General/hotkey/hotkeydialog.cpp2
-rw-r--r--src/plugins/General/hotkey/hotkeymanager_win.cpp2
-rw-r--r--src/plugins/General/hotkey/hotkeymanager_x11.cpp4
-rw-r--r--src/plugins/General/hotkey/settingsdialog.cpp17
-rw-r--r--src/plugins/General/listenbrainz/payloadcache.cpp2
-rw-r--r--src/plugins/General/mpris/player2object.cpp2
-rw-r--r--src/plugins/General/mpris/root2object.cpp4
-rw-r--r--src/plugins/General/notifier/notifier.cpp4
-rw-r--r--src/plugins/General/notifier/settingsdialog.cpp2
-rw-r--r--src/plugins/General/rdetect/removablehelper.cpp6
-rw-r--r--src/plugins/General/rgscan/rgscandialog.cpp18
-rw-r--r--src/plugins/General/scrobbler/scrobbler.cpp10
-rw-r--r--src/plugins/General/scrobbler/scrobblercache.cpp2
-rw-r--r--src/plugins/General/statusicon/qmmptrayicon.cpp2
-rw-r--r--src/plugins/General/streambrowser/streamwindow.cpp8
-rw-r--r--src/plugins/General/udisks2/udisks2device.cpp4
-rw-r--r--src/plugins/General/udisks2/udisks2plugin.cpp16
23 files changed, 78 insertions, 75 deletions
diff --git a/src/plugins/General/converter/converterdialog.cpp b/src/plugins/General/converter/converterdialog.cpp
index fc4916c7d..90de6aca1 100644
--- a/src/plugins/General/converter/converterdialog.cpp
+++ b/src/plugins/General/converter/converterdialog.cpp
@@ -44,7 +44,7 @@ ConverterDialog::ConverterDialog(QList <PlayListTrack *> tracks, QWidget *paren
QStringList paths;
MetaDataFormatter formatter("%if(%p&%t,%p - %t,%f) - %l");
- foreach(PlayListTrack *track, tracks)
+ for(const PlayListTrack *track : qAsConst(tracks))
{
//skip streams
if(track->duration() == 0 || track->path().contains("://"))
@@ -148,7 +148,7 @@ void ConverterDialog::on_stopButton_clicked()
if(m_converters.isEmpty())
return;
- foreach(Converter *c, m_converters)
+ for(Converter *c : qAsConst(m_converters))
c->stop();
QThreadPool::globalInstance()->waitForDone();
qDeleteAll(m_converters);
@@ -287,7 +287,7 @@ void ConverterDialog::readPresets(const QString &path)
dataList.last()[key] = value;
}
- foreach(QVariantMap data, dataList)
+ for(QVariantMap data : qAsConst(dataList))
{
data["read_only"] = path.startsWith(":/");
QString title = data["name"].toString();
diff --git a/src/plugins/General/copypaste/copypaste.cpp b/src/plugins/General/copypaste/copypaste.cpp
index e3401d5aa..c2ef73565 100644
--- a/src/plugins/General/copypaste/copypaste.cpp
+++ b/src/plugins/General/copypaste/copypaste.cpp
@@ -65,7 +65,7 @@ void CopyPaste::cut()
qDebug("%s", Q_FUNC_INFO);
qDeleteAll(m_buffer);
m_buffer.clear();
- foreach(PlayListTrack *track, m_pl_manager->selectedPlayList()->selectedTracks())
+ for(PlayListTrack *track : m_pl_manager->selectedPlayList()->selectedTracks())
{
m_buffer.append(new PlayListTrack(*track));
}
@@ -77,7 +77,7 @@ void CopyPaste::copy()
qDebug("%s", Q_FUNC_INFO);
qDeleteAll(m_buffer);
m_buffer.clear();
- foreach(PlayListTrack *track, m_pl_manager->selectedPlayList()->selectedTracks())
+ for(PlayListTrack *track : m_pl_manager->selectedPlayList()->selectedTracks())
{
m_buffer.append(new PlayListTrack(*track));
}
@@ -86,7 +86,7 @@ void CopyPaste::copy()
void CopyPaste::paste()
{
qDebug("%s", Q_FUNC_INFO);
- foreach(PlayListTrack *track, m_buffer)
+ for(const PlayListTrack *track : qAsConst( m_buffer))
{
m_pl_manager->selectedPlayList()->add(new PlayListTrack(*track));
}
diff --git a/src/plugins/General/covermanager/coverwidget.cpp b/src/plugins/General/covermanager/coverwidget.cpp
index 87169b376..b41f70293 100644
--- a/src/plugins/General/covermanager/coverwidget.cpp
+++ b/src/plugins/General/covermanager/coverwidget.cpp
@@ -50,7 +50,7 @@ CoverWidget::CoverWidget(QWidget *parent)
//settings
QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
m_size = settings.value("CoverManager/size", 0).toInt();
- foreach(QAction *a, sizeMenu->actions ())
+ for(QAction *a : sizeMenu->actions ())
{
a->setCheckable(true);
if(a->data().toInt() == m_size)
diff --git a/src/plugins/General/fileops/fileops.cpp b/src/plugins/General/fileops/fileops.cpp
index 16058fdc9..a6478438b 100644
--- a/src/plugins/General/fileops/fileops.cpp
+++ b/src/plugins/General/fileops/fileops.cpp
@@ -113,7 +113,7 @@ void FileOps::execAction(int n)
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
break;
- foreach(PlayListTrack *track, tracks)
+ for(PlayListTrack *track : qAsConst(tracks))
{
if (QFile::exists(track->path()) && QFile::remove(track->path()))
model->removeTrack(track);
@@ -151,7 +151,7 @@ void FileOps::copy(QList<PlayListTrack *> tracks, const QString &dest, MetaDataF
progress.show();
progress.setAutoClose (false);
int i = 0;
- foreach(PlayListTrack *track, tracks)
+ for(const PlayListTrack *track : qAsConst(tracks))
{
if (!QFile::exists(track->path()))
continue;
@@ -207,9 +207,9 @@ void FileOps::copy(QList<PlayListTrack *> tracks, const QString &dest, MetaDataF
progress.close();
}
-void FileOps::rename(QList<PlayListTrack *> tracks, MetaDataFormatter *formatter, PlayListModel *model)
+void FileOps::rename(const QList<PlayListTrack *> &tracks, MetaDataFormatter *formatter, PlayListModel *model)
{
- foreach(PlayListTrack *track, tracks)
+ for(PlayListTrack *track : qAsConst(tracks))
{
if (!QFile::exists(track->path())) //is it file?
continue;
@@ -232,7 +232,7 @@ void FileOps::rename(QList<PlayListTrack *> tracks, MetaDataFormatter *formatter
}
}
-void FileOps::move(QList<PlayListTrack *> tracks, const QString &dest, MetaDataFormatter *formatter, PlayListModel *model)
+void FileOps::move(const QList<PlayListTrack *> &tracks, const QString &dest, MetaDataFormatter *formatter, PlayListModel *model)
{
QProgressDialog progress(qApp->activeWindow ());
progress.setWindowModality(Qt::WindowModal);
@@ -241,7 +241,7 @@ void FileOps::move(QList<PlayListTrack *> tracks, const QString &dest, MetaDataF
progress.show();
progress.setAutoClose (false);
int i = 0;
- foreach(PlayListTrack *track, tracks)
+ for(PlayListTrack *track : qAsConst(tracks))
{
if (!QFile::exists(track->path()))
continue;
diff --git a/src/plugins/General/fileops/fileops.h b/src/plugins/General/fileops/fileops.h
index 0ad1fa27e..6fe500ab0 100644
--- a/src/plugins/General/fileops/fileops.h
+++ b/src/plugins/General/fileops/fileops.h
@@ -54,9 +54,9 @@ private slots:
private:
void copy(QList<PlayListTrack*> tracks, const QString &dest, MetaDataFormatter *formatter);
- void rename(QList<PlayListTrack*> tracks, MetaDataFormatter *formatter,
+ void rename(const QList<PlayListTrack *> &tracks, MetaDataFormatter *formatter,
PlayListModel *model);
- void move(QList<PlayListTrack*> tracks, const QString &dest, MetaDataFormatter *formatter,
+ void move(const QList<PlayListTrack*> &tracks, const QString &dest, MetaDataFormatter *formatter,
PlayListModel *model);
QList <int> m_types;
diff --git a/src/plugins/General/hal/halplugin.cpp b/src/plugins/General/hal/halplugin.cpp
index 5b795d3d5..ca1e0952a 100644
--- a/src/plugins/General/hal/halplugin.cpp
+++ b/src/plugins/General/hal/halplugin.cpp
@@ -47,7 +47,7 @@ HalPlugin::HalPlugin(QObject *parent) : QObject(parent)
m_addFiles = false;
//find existing devices
QStringList udis = m_manager->findDeviceByCapability("volume");
- foreach(QString udi, udis)
+ for(const QString &udi : qAsConst(udis))
addDevice(udi);
//load remaining settings
m_addTracks = settings.value("add_tracks", false).toBool();
@@ -63,7 +63,7 @@ HalPlugin::~HalPlugin()
void HalPlugin::removeDevice(const QString &udi)
{
- foreach(HalDevice *device, m_devices)
+ for(HalDevice *device : qAsConst(m_devices))
{
if (device->udi() == udi)
{
@@ -78,7 +78,7 @@ void HalPlugin::removeDevice(const QString &udi)
void HalPlugin::addDevice(const QString &udi)
{
- foreach(HalDevice *device, m_devices) //is it already exists?
+ for(const HalDevice *device : qAsConst(m_devices)) //is it already exists?
{
if (device->udi() == udi)
return;
@@ -141,7 +141,7 @@ void HalPlugin::addDevice(const QString &udi)
void HalPlugin::updateActions()
{
// add action for cd audio or mounted volume
- foreach(HalDevice *device, m_devices)
+ for(HalDevice *device : qAsConst(m_devices))
{
QStringList caps = device->property("info.capabilities").toStringList();
QString dev_path;
@@ -184,7 +184,7 @@ void HalPlugin::updateActions()
}
}
// remove action if device is unmounted/removed
- foreach(QAction *action, m_actions->actions ())
+ for(QAction *action :m_actions->actions ())
{
if (!findDevice(action))
{
@@ -205,7 +205,7 @@ void HalPlugin::processAction(QAction *action)
QAction *HalPlugin::findAction(const QString &dev_path)
{
- foreach(QAction *action, m_actions->actions ())
+ for(QAction *action : m_actions->actions())
{
if (action->data().toString() == dev_path)
return action;
@@ -215,7 +215,7 @@ QAction *HalPlugin::findAction(const QString &dev_path)
HalDevice *HalPlugin::findDevice(QAction *action)
{
- foreach(HalDevice *device, m_devices)
+ for(HalDevice *device : qAsConst(m_devices))
{
QStringList caps = device->property("info.capabilities").toStringList();
QString dev_path;
@@ -239,11 +239,11 @@ void HalPlugin::addPath(const QString &path)
{
PlayListModel *model = PlayListManager::instance()->selectedPlayList();
- foreach(PlayListItem *item, model->items()) // Is it already exist?
+ for(const PlayListItem *item : model->items()) // Is it already exist?
{
if(item->isGroup())
continue;
- if (dynamic_cast<PlayListTrack *>(item)->path().startsWith(path))
+ if (dynamic_cast<const PlayListTrack *>(item)->path().startsWith(path))
return;
}
diff --git a/src/plugins/General/hotkey/hotkeydialog.cpp b/src/plugins/General/hotkey/hotkeydialog.cpp
index e522acc77..4d0c9ac00 100644
--- a/src/plugins/General/hotkey/hotkeydialog.cpp
+++ b/src/plugins/General/hotkey/hotkeydialog.cpp
@@ -38,7 +38,7 @@ void HotkeyDialog::keyPressEvent (QKeyEvent *event)
{
m_key = HotkeyManager::keycodeToKeysym(event->nativeScanCode ());
m_modifiers = event->nativeModifiers ();
- foreach(long mask_mod, HotkeyManager::ignModifiersList())
+ for(long mask_mod : HotkeyManager::ignModifiersList())
m_modifiers &= ~mask_mod; //remove ignored modifiers (num lock, caps lock, etc)
m_ui.keyLineEdit->setText(HotkeyManager::getKeyString(m_key, m_modifiers));
diff --git a/src/plugins/General/hotkey/hotkeymanager_win.cpp b/src/plugins/General/hotkey/hotkeymanager_win.cpp
index aa0cdd6b5..950b57438 100644
--- a/src/plugins/General/hotkey/hotkeymanager_win.cpp
+++ b/src/plugins/General/hotkey/hotkeymanager_win.cpp
@@ -226,7 +226,7 @@ bool HotkeyManager::nativeEventFilter(const QByteArray &eventType, void *message
{
SoundCore *core = SoundCore::instance();
MediaPlayer *player = MediaPlayer::instance();
- foreach(Hotkey *hotkey, m_grabbedKeys)
+ for(const Hotkey *hotkey : qAsConst(m_grabbedKeys))
{
if(hotkey->id != m->wParam)
continue;
diff --git a/src/plugins/General/hotkey/hotkeymanager_x11.cpp b/src/plugins/General/hotkey/hotkeymanager_x11.cpp
index 26aac352b..6819523c6 100644
--- a/src/plugins/General/hotkey/hotkeymanager_x11.cpp
+++ b/src/plugins/General/hotkey/hotkeymanager_x11.cpp
@@ -95,7 +95,7 @@ HotkeyManager::HotkeyManager(QObject *parent) : QObject(parent)
if (key)
{
- foreach(long mask_mod, ignModifiersList())
+ for(long mask_mod : ignModifiersList())
{
Hotkey *hotkey = new Hotkey;
hotkey->action = i;
@@ -155,7 +155,7 @@ bool HotkeyManager::nativeEventFilter(const QByteArray &eventType, void *message
quint32 mod = ke->state;
SoundCore *core = SoundCore::instance();
MediaPlayer *player = MediaPlayer::instance();
- foreach(Hotkey *hotkey, m_grabbedKeys)
+ for(const Hotkey *hotkey : qAsConst(m_grabbedKeys))
{
if (hotkey->key != key || hotkey->mod != mod)
continue;
diff --git a/src/plugins/General/hotkey/settingsdialog.cpp b/src/plugins/General/hotkey/settingsdialog.cpp
index 7a5bd612d..1255790e2 100644
--- a/src/plugins/General/hotkey/settingsdialog.cpp
+++ b/src/plugins/General/hotkey/settingsdialog.cpp
@@ -75,7 +75,7 @@ void SettingsDialog::accept()
{
QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
settings.beginGroup("Hotkey");
- foreach(Hotkey *k, m_hotkeys)
+ for(const Hotkey *k : qAsConst(m_hotkeys))
{
settings.setValue(QString("key_%1").arg(k->action), k->key);
settings.setValue(QString("modifiers_%1").arg(k->action), k->mod);
@@ -86,16 +86,19 @@ void SettingsDialog::accept()
void SettingsDialog::on_tableWidget_itemDoubleClicked (QTableWidgetItem *item)
{
- Hotkey *k = nullptr;
- foreach(k, m_hotkeys)
+ Hotkey *key = nullptr;
+ for(Hotkey *k : m_hotkeys)
{
if (k->action == item->type())
+ {
+ key = k;
break;
+ }
}
- if (!k)
+ if (!key)
return;
- HotkeyDialog *dialog = new HotkeyDialog(k->key, k->mod, this);
+ HotkeyDialog *dialog = new HotkeyDialog(key->key, key->mod, this);
if (item->type() >= QTableWidgetItem::UserType &&
dialog->exec() == QDialog::Accepted)
{
@@ -104,8 +107,8 @@ void SettingsDialog::on_tableWidget_itemDoubleClicked (QTableWidgetItem *item)
if(keyString.isEmpty() || items.isEmpty() || items.first() == item)
{
item->setText(keyString);
- k->key = dialog->keySym ();
- k->mod = dialog->nativeModifiers ();
+ key->key = dialog->keySym ();
+ key->mod = dialog->nativeModifiers ();
}
else
QMessageBox::warning(this, tr("Warning"), tr("Key sequence '%1' is already used").arg(keyString));
diff --git a/src/plugins/General/listenbrainz/payloadcache.cpp b/src/plugins/General/listenbrainz/payloadcache.cpp
index f9e305c66..f142cbd7e 100644
--- a/src/plugins/General/listenbrainz/payloadcache.cpp
+++ b/src/plugins/General/listenbrainz/payloadcache.cpp
@@ -129,7 +129,7 @@ void PayloadCache::save(const QList<TrackMetaData> &songs)
qWarning("PayloadCache: error %d: %s", file.error(), qPrintable(file.errorString()));
return;
}
- foreach(TrackMetaData m, songs)
+ for(const TrackMetaData &m : qAsConst(songs))
{
file.write(QString("title=%1").arg(m.value(Qmmp::TITLE)).toUtf8() +"\n");
file.write(QString("artist=%1").arg(m.value(Qmmp::ARTIST)).toUtf8() +"\n");
diff --git a/src/plugins/General/mpris/player2object.cpp b/src/plugins/General/mpris/player2object.cpp
index 7773d86ae..e1b511be5 100644
--- a/src/plugins/General/mpris/player2object.cpp
+++ b/src/plugins/General/mpris/player2object.cpp
@@ -313,7 +313,7 @@ void Player2Object::emitPropertiesChanged()
syncProperties();
QVariantMap map;
- foreach(QByteArray name, changedProps)
+ for(const QByteArray &name : qAsConst(changedProps))
map.insert(name, m_props.value(name));
QDBusMessage msg = QDBusMessage::createSignal("/org/mpris/MediaPlayer2",
diff --git a/src/plugins/General/mpris/root2object.cpp b/src/plugins/General/mpris/root2object.cpp
index a7e9bdd50..dfc7b8edb 100644
--- a/src/plugins/General/mpris/root2object.cpp
+++ b/src/plugins/General/mpris/root2object.cpp
@@ -64,9 +64,9 @@ QString Root2Object::identity() const
QStringList Root2Object::supportedMimeTypes() const
{
QStringList mimeTypes;
- foreach(DecoderFactory *factory, Decoder::enabledFactories())
+ for(const DecoderFactory *factory : Decoder::enabledFactories())
mimeTypes << factory->properties().contentTypes;
- foreach(EngineFactory *factory, AbstractEngine::enabledFactories())
+ for(const EngineFactory *factory : AbstractEngine::enabledFactories())
mimeTypes << factory->properties().contentTypes;
mimeTypes.removeDuplicates();
return mimeTypes;
diff --git a/src/plugins/General/notifier/notifier.cpp b/src/plugins/General/notifier/notifier.cpp
index 1ad9e6a19..62b4b5641 100644
--- a/src/plugins/General/notifier/notifier.cpp
+++ b/src/plugins/General/notifier/notifier.cpp
@@ -138,7 +138,7 @@ void Notifier::showMetaData()
data.append(m_core->metaData(Qmmp::TRACK).toUtf8()+"\n");
data.append(QString("%1").arg(m_core->duration()/1000).toUtf8()+"\n");
- foreach(QString path, m_psiTuneFiles)
+ for(const QString &path : qAsConst(m_psiTuneFiles))
{
QDir tuneDir = QFileInfo(path).absoluteDir();
if(!tuneDir.exists())
@@ -170,7 +170,7 @@ void Notifier::removePsiTuneFiles()
{
if(m_psi) //clear psi notification
{
- foreach(QString path, m_psiTuneFiles)
+ for(const QString &path : qAsConst(m_psiTuneFiles))
QFile::remove(path);
}
}
diff --git a/src/plugins/General/notifier/settingsdialog.cpp b/src/plugins/General/notifier/settingsdialog.cpp
index af5fcaad3..22dd32334 100644
--- a/src/plugins/General/notifier/settingsdialog.cpp
+++ b/src/plugins/General/notifier/settingsdialog.cpp
@@ -73,7 +73,7 @@ void SettingsDialog::accept()
settings.beginGroup("Notifier");
settings.setValue ("message_delay", m_ui.messageDelaySpinBox->value());
uint pos = PopupWidget::BOTTOMLEFT;
- foreach (QPushButton *button, m_buttons.values())
+ for(QPushButton *button : m_buttons.values())
{
if(button->isChecked())
pos = m_buttons.key(button);
diff --git a/src/plugins/General/rdetect/removablehelper.cpp b/src/plugins/General/rdetect/removablehelper.cpp
index ad4f37a7a..0e891f5ca 100644
--- a/src/plugins/General/rdetect/removablehelper.cpp
+++ b/src/plugins/General/rdetect/removablehelper.cpp
@@ -155,7 +155,7 @@ void RemovableHelper::updateActions()
}
}
// remove action if device is unmounted/removed
- foreach(QAction *action, m_actions->actions())
+ for(const QAction *action : m_actions->actions())
{
bool found = false;
@@ -188,7 +188,7 @@ void RemovableHelper::updateActions()
QAction *RemovableHelper::findAction(const QString &dev_path)
{
- foreach(QAction *action, m_actions->actions())
+ for(const QAction *action : m_actions->actions())
{
if (action->data().toString() == dev_path)
return action;
@@ -200,7 +200,7 @@ void RemovableHelper::addPath(const QString &path)
{
PlayListModel *model = PlayListManager::instance()->selectedPlayList();
- foreach(PlayListItem *item, model->items()) // Is it already exist?
+ for(const PlayListItem *item : model->items()) // Is it already exist?
{
if(item->isGroup())
continue;
diff --git a/src/plugins/General/rgscan/rgscandialog.cpp b/src/plugins/General/rgscan/rgscandialog.cpp
index 78a5276d4..6faa1a225 100644
--- a/src/plugins/General/rgscan/rgscandialog.cpp
+++ b/src/plugins/General/rgscan/rgscandialog.cpp
@@ -58,7 +58,7 @@ RGScanDialog::RGScanDialog(QList <PlayListTrack *> tracks, QWidget *parent) : Q
QStringList paths;
MetaDataFormatter formatter("%if(%p&%t,%p - %t,%f) - %l");
- foreach(PlayListTrack *track, tracks)
+ for(const PlayListTrack *track : qAsConst(tracks))
{
//skip streams
if(track->duration() == 0 || track->path().contains("://"))
@@ -163,7 +163,7 @@ void RGScanDialog::onScanFinished(QString url)
bool stopped = true;
- foreach (RGScanner *scanner, m_scanners)
+ for(const RGScanner *scanner : qAsConst(m_scanners))
{
if(scanner->isRunning() || scanner->isPending())
stopped = false;
@@ -177,7 +177,7 @@ void RGScanDialog::onScanFinished(QString url)
QMultiMap<QString, ReplayGainInfoItem*> itemGroupMap; //items grouped by album
//group by album name
- foreach (RGScanner *scanner, m_scanners)
+ for(RGScanner *scanner : qAsConst(m_scanners))
{
if(!scanner->hasValues())
continue;
@@ -190,7 +190,7 @@ void RGScanDialog::onScanFinished(QString url)
itemGroupMap.insert(album, item);
}
//calculate album peak and gain
- foreach (QString album, itemGroupMap.keys())
+ for(const QString &album : itemGroupMap.keys())
{
QList<ReplayGainInfoItem*> items = itemGroupMap.values(album);
GainHandle_t **a = (GainHandle_t **) malloc(items.count()*sizeof(GainHandle_t *));
@@ -202,7 +202,7 @@ void RGScanDialog::onScanFinished(QString url)
}
double album_gain = GetAlbumGain(a, items.count());
free(a);
- foreach (ReplayGainInfoItem *item, items)
+ for(ReplayGainInfoItem *item : qAsConst(items))
{
item->info[Qmmp::REPLAYGAIN_ALBUM_PEAK] = album_peak;
item->info[Qmmp::REPLAYGAIN_ALBUM_GAIN] = album_gain;
@@ -220,7 +220,7 @@ void RGScanDialog::onScanFinished(QString url)
{
QString url = m_ui.tableWidget->item(i, 0)->data(Qt::UserRole).toString();
bool found = false;
- foreach (ReplayGainInfoItem *item, m_replayGainItemList)
+ for(const ReplayGainInfoItem *item : qAsConst(m_replayGainItemList))
{
if(item->url == url)
{
@@ -256,7 +256,7 @@ void RGScanDialog::stop()
{
if(m_scanners.isEmpty())
return;
- foreach (RGScanner *scaner, m_scanners)
+ for(RGScanner *scaner : qAsConst(m_scanners))
{
scaner->stop();
}
@@ -267,7 +267,7 @@ void RGScanDialog::stop()
RGScanner *RGScanDialog::findScannerByUrl(const QString &url)
{
- foreach (RGScanner *scanner, m_scanners)
+ for(RGScanner *scanner : qAsConst(m_scanners))
{
if(scanner->url() == url)
return scanner;
@@ -395,7 +395,7 @@ void RGScanDialog::on_writeButton_clicked()
qDebug("RGScanDialog: writing ReplayGain values...");
- foreach (ReplayGainInfoItem *item, m_replayGainItemList)
+ for(ReplayGainInfoItem *item : qAsConst(m_replayGainItemList))
{
QString ext = item->url.section(".", -1).toLower();
diff --git a/src/plugins/General/scrobbler/scrobbler.cpp b/src/plugins/General/scrobbler/scrobbler.cpp
index cc40e9c3f..510f2e6aa 100644
--- a/src/plugins/General/scrobbler/scrobbler.cpp
+++ b/src/plugins/General/scrobbler/scrobbler.cpp
@@ -298,7 +298,7 @@ void Scrobbler::submit()
params.insert("sk", m_session);
QStringList keys = params.keys();
- foreach (QString key, keys) //removes empty keys
+ for(const QString &key : qAsConst(keys)) //removes empty keys
{
if(params.value(key).isEmpty() || params.value(key) == "0")
params.remove(key);
@@ -309,7 +309,7 @@ void Scrobbler::submit()
QUrlQuery body("");
QByteArray data;
- foreach (QString key, params.keys())
+ for(const QString &key : params.keys())
{
body.addQueryItem(key, params.value(key));
data.append(key.toUtf8() + params.value(key).toUtf8());
@@ -347,7 +347,7 @@ void Scrobbler::sendNotification(const SongInfo &info)
params.insert("method", "track.updateNowPlaying");
params.insert("sk", m_session);
- foreach (QString key, params) //removes empty keys
+ for(const QString &key : qAsConst(params)) //removes empty keys
{
if(params.value(key).isEmpty())
params.remove(key);
@@ -358,7 +358,7 @@ void Scrobbler::sendNotification(const SongInfo &info)
QUrlQuery body("");
QByteArray data;
- foreach (QString key, params.keys())
+ for(const QString &key : params.keys())
{
body.addQueryItem(key, params.value(key));
data.append(key.toUtf8() + params.value(key).toUtf8());
@@ -469,7 +469,7 @@ void ScrobblerAuth::checkSession(const QString &session)
QUrlQuery body("");
QByteArray data;
- foreach (QString key, params.keys())
+ for(const QString &key : params.keys())
{
body.addQueryItem(key, params.value(key));
data.append(key.toUtf8() + params.value(key).toUtf8());
diff --git a/src/plugins/General/scrobbler/scrobblercache.cpp b/src/plugins/General/scrobbler/scrobblercache.cpp
index 05319e2a3..9ede37e67 100644
--- a/src/plugins/General/scrobbler/scrobblercache.cpp
+++ b/src/plugins/General/scrobbler/scrobblercache.cpp
@@ -129,7 +129,7 @@ void ListenCache::save(const QList<SongInfo> &songs)
qWarning("ScrobblerCache: error %d: %s", file.error(), qPrintable(file.errorString()));
return;
}
- foreach(SongInfo m, songs)
+ for(const SongInfo &m : qAsConst(songs))
{
file.write(QString("title=%1").arg(m.value(Qmmp::TITLE)).toUtf8() +"\n");
file.write(QString("artist=%1").arg(m.value(Qmmp::ARTIST)).toUtf8() +"\n");
diff --git a/src/plugins/General/statusicon/qmmptrayicon.cpp b/src/plugins/General/statusicon/qmmptrayicon.cpp
index 4c435c64d..50af945db 100644
--- a/src/plugins/General/statusicon/qmmptrayicon.cpp
+++ b/src/plugins/General/statusicon/qmmptrayicon.cpp
@@ -78,7 +78,7 @@ bool QmmpTrayIcon::hasToolTipEvent()
{
//checking for XEmbed system tray implementation
//only this implementation is able to send QHelpEvent
- foreach (QWindow *w, qApp->allWindows())
+ for(const QWindow *w : qApp->allWindows())
{
if(w->objectName() == "QSystemTrayIconSysWindow")
return true;
diff --git a/src/plugins/General/streambrowser/streamwindow.cpp b/src/plugins/General/streambrowser/streamwindow.cpp
index dc276e872..d668068d4 100644
--- a/src/plugins/General/streambrowser/streamwindow.cpp
+++ b/src/plugins/General/streambrowser/streamwindow.cpp
@@ -185,7 +185,7 @@ void StreamWindow::on_addPushButton_clicked()
if(m_ui->tabWidget->currentIndex() == 0)
{
QModelIndexList indexes = m_ui->favoritesTableView->selectionModel()->selectedRows(0);
- foreach(QModelIndex index, indexes)
+ for(const QModelIndex &index : qAsConst(indexes))
{
QModelIndex source_index = m_favoritesFilterModel->mapToSource(index);
tracks << new PlayListTrack();
@@ -198,7 +198,7 @@ void StreamWindow::on_addPushButton_clicked()
else
{
QModelIndexList indexes = m_ui->icecastTableView->selectionModel()->selectedRows(0);
- foreach(QModelIndex index, indexes)
+ for(const QModelIndex &index : qAsConst(indexes))
{
QModelIndex source_index = m_iceCastFilterModel->mapToSource(index);
tracks << new PlayListTrack();
@@ -235,7 +235,7 @@ void StreamWindow::execFavoritesMenu(const QPoint &pos)
void StreamWindow::addToFavorites()
{
QModelIndexList indexes = m_ui->icecastTableView->selectionModel()->selectedRows(0);
- foreach(QModelIndex index, indexes)
+ for(const QModelIndex &index : qAsConst(indexes))
{
QModelIndex source_index = m_iceCastFilterModel->mapToSource(index);
int row = source_index.row();
@@ -309,7 +309,7 @@ void StreamWindow::removeFromFavorites()
return;
QModelIndexList indexes = m_ui->favoritesTableView->selectionModel()->selectedRows(0);
QList<int> rows_to_remove;
- foreach(QModelIndex index, indexes)
+ for(const QModelIndex &index : qAsConst(indexes))
{
rows_to_remove.append(m_favoritesFilterModel->mapToSource(index).row());
}
diff --git a/src/plugins/General/udisks2/udisks2device.cpp b/src/plugins/General/udisks2/udisks2device.cpp
index db0e88f85..e30ae16dd 100644
--- a/src/plugins/General/udisks2/udisks2device.cpp
+++ b/src/plugins/General/udisks2/udisks2device.cpp
@@ -90,7 +90,7 @@ QStringList UDisks2Device::mountPoints() const
QList<QVariant> args = reply.arguments();
- foreach (QVariant arg, args)
+ for(const QVariant &arg : qAsConst(args))
{
QByteArrayList list;
QDBusArgument a = arg.value<QDBusVariant>().variant().value<QDBusArgument>();
@@ -98,7 +98,7 @@ QStringList UDisks2Device::mountPoints() const
continue;
a >> list;
- foreach (QByteArray p, list)
+ for(const QByteArray &p : qAsConst(list))
points.append(p);
}
return points;
diff --git a/src/plugins/General/udisks2/udisks2plugin.cpp b/src/plugins/General/udisks2/udisks2plugin.cpp
index be73686b3..d249c06b0 100644
--- a/src/plugins/General/udisks2/udisks2plugin.cpp
+++ b/src/plugins/General/udisks2/udisks2plugin.cpp
@@ -49,7 +49,7 @@ UDisks2Plugin::UDisks2Plugin(QObject *parent) : QObject(parent)
m_addFiles = false;
//find existing devices
QList<QDBusObjectPath> devs = m_manager->findAllDevices();
- foreach(QDBusObjectPath o, devs)
+ for(const QDBusObjectPath &o : qAsConst(devs))
addDevice(o);
//load remaining settings
m_addTracks = settings.value("add_tracks", false).toBool();
@@ -65,7 +65,7 @@ UDisks2Plugin::~UDisks2Plugin()
void UDisks2Plugin::removeDevice(QDBusObjectPath o)
{
- foreach(UDisks2Device *device, m_devices)
+ for(UDisks2Device *device : qAsConst(m_devices))
{
if (device->objectPath() == o)
{
@@ -80,7 +80,7 @@ void UDisks2Plugin::removeDevice(QDBusObjectPath o)
void UDisks2Plugin::addDevice(QDBusObjectPath o)
{
- foreach(UDisks2Device *device, m_devices) //is it already exists?
+ for(const UDisks2Device *device : qAsConst(m_devices)) //is it already exists?
{
if (device->objectPath() == o)
return;
@@ -101,7 +101,7 @@ void UDisks2Plugin::addDevice(QDBusObjectPath o)
void UDisks2Plugin::updateActions()
{
// add action for cd audio or mounted volume
- foreach(UDisks2Device *device, m_devices)
+ for(const UDisks2Device *device : qAsConst(m_devices))
{
QString dev_path;
if (m_detectCDA && device->isAudio()) //cd audio
@@ -157,7 +157,7 @@ void UDisks2Plugin::updateActions()
}
}
// remove action if device is unmounted/removed
- foreach(QAction *action, m_actions->actions ())
+ for(QAction *action : m_actions->actions())
{
if (!findDevice(action))
{
@@ -179,7 +179,7 @@ void UDisks2Plugin::processAction(QAction *action)
QAction *UDisks2Plugin::findAction(const QString &dev_path)
{
- foreach(QAction *action, m_actions->actions ())
+ for(QAction *action : m_actions->actions())
{
if (action->data().toString() == dev_path)
return action;
@@ -189,7 +189,7 @@ QAction *UDisks2Plugin::findAction(const QString &dev_path)
UDisks2Device *UDisks2Plugin::findDevice(QAction *action)
{
- foreach(UDisks2Device *device, m_devices)
+ for(UDisks2Device *device : qAsConst(m_devices))
{
QString dev_path;
if (device->isAudio())
@@ -212,7 +212,7 @@ void UDisks2Plugin::addPath(const QString &path)
{
PlayListModel *model = PlayListManager::instance()->selectedPlayList();
- foreach(PlayListItem *item, model->items()) // Is it already exist?
+ for(PlayListItem *item : model->items()) // Is it already exist?
{
if(item->isGroup())
continue;