From cebb4b86b5fb1dac4c144f6d64c17ab9f9ea89ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 24 Sep 2013 14:31:35 +0200 Subject: [PATCH] Use new for-loop instead of foreach in kwin/effects.cpp kdevelop was causing parsing errors, so I had to do it ;-) --- effects.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/effects.cpp b/effects.cpp index 6abb6ffb3b..687ffe3e12 100644 --- a/effects.cpp +++ b/effects.cpp @@ -249,10 +249,10 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene) #endif connect(m_screenLockerWatcher, SIGNAL(locked(bool)), SIGNAL(screenLockingChanged(bool))); // connect all clients - foreach (Client *c, ws->clientList()) { + for (Client *c : ws->clientList()) { setupClientConnections(c); } - foreach (Unmanaged *u, ws->unmanagedList()) { + for (Unmanaged *u : ws->unmanagedList()) { setupUnmanagedConnections(u); } reconfigure(); @@ -262,8 +262,8 @@ EffectsHandlerImpl::~EffectsHandlerImpl() { if (keyboard_grab_effect != NULL) ungrabKeyboard(); - foreach (const EffectPair & ep, loaded_effects) - unloadEffect(ep.first); + for (const EffectPair & ep : loaded_effects) + unloadEffect(ep.first); } void EffectsHandlerImpl::setupClientConnections(Client* c) @@ -316,7 +316,7 @@ void EffectsHandlerImpl::slotEffectsQueried() KConfigGroup conf(KSharedConfig::openConfig(), "Plugins"); // First unload necessary effects - foreach (const KService::Ptr & service, offers) { + for (const KService::Ptr & service : offers) { KPluginInfo plugininfo(service); plugininfo.load(conf); @@ -335,13 +335,13 @@ void EffectsHandlerImpl::slotEffectsQueried() } QStringList newLoaded; // Then load those that should be loaded - foreach (const QString & effectName, effectsToBeLoaded) { + for (const QString & effectName : effectsToBeLoaded) { if (!isEffectLoaded(effectName)) { if (loadEffect(effectName, checkDefault.contains(effectName))) newLoaded.append(effectName); } } - foreach (const EffectPair & ep, loaded_effects) { + for (const EffectPair & ep : loaded_effects) { if (!newLoaded.contains(ep.first)) // don't reconfigure newly loaded effects ep.second->reconfigure(Effect::ReconfigureAll); } @@ -1039,7 +1039,7 @@ EffectWindowList EffectsHandlerImpl::stackingOrder() const { ToplevelList list = Workspace::self()->xStackingOrder(); EffectWindowList ret; - foreach (Toplevel *t, list) { + for (Toplevel *t : list) { if (EffectWindow *w = effectWindow(t)) ret.append(w); } @@ -1079,7 +1079,7 @@ EffectWindowList EffectsHandlerImpl::currentTabBoxWindowList() const EffectWindowList ret; ClientList clients; clients = TabBox::TabBox::self()->currentClientList(); - foreach (Client * c, clients) + for (Client * c : clients) ret.append(c->effectWindow()); return ret; #else @@ -1318,7 +1318,7 @@ QStringList EffectsHandlerImpl::listOfEffects() const KService::List offers = KServiceTypeTrader::self()->query(QStringLiteral("KWin/Effect")); QStringList listOfModules; // First unload necessary effects - foreach (const KService::Ptr & service, offers) { + for (const KService::Ptr & service : offers) { KPluginInfo plugininfo(service); listOfModules << plugininfo.pluginName(); } @@ -1423,7 +1423,7 @@ bool EffectsHandlerImpl::loadEffect(const QString& name, bool checkDefault) // TODO: detect circular deps KPluginInfo plugininfo(service); QStringList dependencies = plugininfo.dependencies(); - foreach (const QString & depName, dependencies) { + for (const QString & depName : dependencies) { if (!loadEffect(depName)) { qCritical() << "EffectsHandler::loadEffect : Couldn't load dependencies for effect " << name << endl; library->unload(); @@ -1482,7 +1482,7 @@ void EffectsHandlerImpl::unloadEffect(const QString& name) stopMouseInterception(it.value().second); // remove support properties for the effect const QList properties = m_propertiesForEffects.keys(); - foreach (const QByteArray &property, properties) { + for (const QByteArray &property : properties) { removeSupportProperty(property, it.value().second); } delete it.value().second; @@ -1536,7 +1536,7 @@ void EffectsHandlerImpl::effectsChanged() loaded_effects.clear(); m_activeEffects.clear(); // it's possible to have a reconfigure and a quad rebuild between two paint cycles - bug #308201 // qDebug() << "Recreating effects' list:"; - foreach (const EffectPair & effect, effect_order) { + for (const EffectPair & effect : effect_order) { // qDebug() << effect.first; loaded_effects.append(effect); } @@ -1719,7 +1719,7 @@ EffectWindowList getMainWindows(Toplevel *toplevel) T *c = static_cast(toplevel); EffectWindowList ret; ClientList mainclients = c->mainClients(); - foreach (Client * tmp, mainclients) + for (Client * tmp : mainclients) ret.append(tmp->effectWindow()); return ret; } @@ -1835,7 +1835,7 @@ void EffectWindowImpl::unreferencePreviousWindowPixmap() EffectWindowList EffectWindowGroupImpl::members() const { EffectWindowList ret; - foreach (Toplevel * c, group->members()) + for (Toplevel * c : group->members()) ret.append(c->effectWindow()); return ret; }