Commit eaf74268 authored by Boudewijn Rempt's avatar Boudewijn Rempt Committed by Boudewijn Rempt

Replace foreach with Q_FOREACH

parent 1d00a620
...@@ -87,7 +87,7 @@ void KisBContrastBenchmark::benchmarkFilter() ...@@ -87,7 +87,7 @@ void KisBContrastBenchmark::benchmarkFilter()
QVector<QRect> rects = KritaUtils::splitRectIntoPatches(QRect(0, 0, GMP_IMAGE_WIDTH,GMP_IMAGE_HEIGHT), size); QVector<QRect> rects = KritaUtils::splitRectIntoPatches(QRect(0, 0, GMP_IMAGE_WIDTH,GMP_IMAGE_HEIGHT), size);
QBENCHMARK{ QBENCHMARK{
foreach(const QRect &rc, rects) { Q_FOREACH (const QRect &rc, rects) {
filter->process(m_device, rc, kfc); filter->process(m_device, rc, kfc);
} }
} }
......
...@@ -255,7 +255,7 @@ void freeTiles(QVector<Tile> tiles, ...@@ -255,7 +255,7 @@ void freeTiles(QVector<Tile> tiles,
const int srcAlignmentShift, const int srcAlignmentShift,
const int dstAlignmentShift) const int dstAlignmentShift)
{ {
foreach (const Tile &tile, tiles) { Q_FOREACH (const Tile &tile, tiles) {
free(tile.src - srcAlignmentShift); free(tile.src - srcAlignmentShift);
free(tile.dst - dstAlignmentShift); free(tile.dst - dstAlignmentShift);
free(tile.mask); free(tile.mask);
...@@ -410,7 +410,7 @@ void benchmarkCompositeOp(const KoCompositeOp *op, ...@@ -410,7 +410,7 @@ void benchmarkCompositeOp(const KoCompositeOp *op,
QTime timer; QTime timer;
timer.start(); timer.start();
foreach (const Tile &tile, tiles) { Q_FOREACH (const Tile &tile, tiles) {
params.dstRowStart = tile.dst + tileOffset; params.dstRowStart = tile.dst + tileOffset;
params.srcRowStart = tile.src + tileOffset; params.srcRowStart = tile.src + tileOffset;
params.maskRowStart = haveMask ? tile.mask : 0; params.maskRowStart = haveMask ? tile.mask : 0;
...@@ -724,7 +724,7 @@ void KisCompositionBenchmark::benchmarkMemcpy() ...@@ -724,7 +724,7 @@ void KisCompositionBenchmark::benchmarkMemcpy()
generateTiles(numTiles, 0, 0, ALPHA_UNIT, ALPHA_UNIT, 4); generateTiles(numTiles, 0, 0, ALPHA_UNIT, ALPHA_UNIT, 4);
QBENCHMARK_ONCE { QBENCHMARK_ONCE {
foreach (const Tile &tile, tiles) { Q_FOREACH (const Tile &tile, tiles) {
memcpy(tile.dst, tile.src, 4 * numPixels); memcpy(tile.dst, tile.src, 4 * numPixels);
} }
} }
......
...@@ -93,7 +93,7 @@ void KisLevelFilterBenchmark::benchmarkFilter() ...@@ -93,7 +93,7 @@ void KisLevelFilterBenchmark::benchmarkFilter()
QVector<QRect> rects = KritaUtils::splitRectIntoPatches(QRect(0, 0, GMP_IMAGE_WIDTH,GMP_IMAGE_HEIGHT), size); QVector<QRect> rects = KritaUtils::splitRectIntoPatches(QRect(0, 0, GMP_IMAGE_WIDTH,GMP_IMAGE_HEIGHT), size);
QBENCHMARK{ QBENCHMARK{
foreach(const QRect &rc, rects) { Q_FOREACH (const QRect &rc, rects) {
filter->process(m_device, rc, kfc); filter->process(m_device, rc, kfc);
} }
} }
......
...@@ -181,7 +181,7 @@ public: ...@@ -181,7 +181,7 @@ public:
sketchView->setResizeMode( QDeclarativeView::SizeRootObjectToView ); sketchView->setResizeMode( QDeclarativeView::SizeRootObjectToView );
if (sketchView->errors().count() > 0) { if (sketchView->errors().count() > 0) {
foreach(const QDeclarativeError &error, sketchView->errors()) { Q_FOREACH (const QDeclarativeError &error, sketchView->errors()) {
dbgKrita << error.toString(); dbgKrita << error.toString();
} }
} }
...@@ -259,7 +259,7 @@ MainWindow::MainWindow(QStringList fileNames, QWidget* parent, Qt::WindowFlags f ...@@ -259,7 +259,7 @@ MainWindow::MainWindow(QStringList fileNames, QWidget* parent, Qt::WindowFlags f
cfg.setNewCursorStyle(CURSOR_STYLE_NO_CURSOR); cfg.setNewCursorStyle(CURSOR_STYLE_NO_CURSOR);
cfg.setUseOpenGL(true); cfg.setUseOpenGL(true);
foreach(QString fileName, fileNames) { Q_FOREACH (QString fileName, fileNames) {
DocumentManager::instance()->recentFileManager()->addRecent( QDir::current().absoluteFilePath( fileName ) ); DocumentManager::instance()->recentFileManager()->addRecent( QDir::current().absoluteFilePath( fileName ) );
} }
......
...@@ -225,7 +225,7 @@ void DesktopViewProxy::documentChanged() ...@@ -225,7 +225,7 @@ void DesktopViewProxy::documentChanged()
void DesktopViewProxy::updateKeyBindings() void DesktopViewProxy::updateKeyBindings()
{ {
//KisView* view = qobject_cast<KisView*>(d->mainWindow->sketchKisView()); //KisView* view = qobject_cast<KisView*>(d->mainWindow->sketchKisView());
foreach(QAction* action, d->desktopWindow->actions()) { Q_FOREACH (QAction* action, d->desktopWindow->actions()) {
QAction* otherAction = d->desktopWindow->action(action->objectName().toLatin1()); QAction* otherAction = d->desktopWindow->action(action->objectName().toLatin1());
if(otherAction) { if(otherAction) {
otherAction->setShortcut(action->shortcut()); otherAction->setShortcut(action->shortcut());
......
...@@ -265,7 +265,7 @@ void KisPaintOpPreset::toXML(QDomDocument& doc, QDomElement& elt) const ...@@ -265,7 +265,7 @@ void KisPaintOpPreset::toXML(QDomDocument& doc, QDomElement& elt) const
// sanitize the settings // sanitize the settings
bool hasTexture = m_d->settings->getBool("Texture/Pattern/Enabled"); bool hasTexture = m_d->settings->getBool("Texture/Pattern/Enabled");
if (!hasTexture) { if (!hasTexture) {
foreach(const QString & key, m_d->settings->getProperties().keys()) { Q_FOREACH (const QString & key, m_d->settings->getProperties().keys()) {
if (key.startsWith("Texture") && key != "Texture/Pattern/Enabled") { if (key.startsWith("Texture") && key != "Texture/Pattern/Enabled") {
m_d->settings->removeProperty(key); m_d->settings->removeProperty(key);
} }
...@@ -305,7 +305,7 @@ void KisPaintOpPreset::fromXML(const QDomElement& presetElt) ...@@ -305,7 +305,7 @@ void KisPaintOpPreset::fromXML(const QDomElement& presetElt)
// sanitize the settings // sanitize the settings
bool hasTexture = settings->getBool("Texture/Pattern/Enabled"); bool hasTexture = settings->getBool("Texture/Pattern/Enabled");
if (!hasTexture) { if (!hasTexture) {
foreach(const QString & key, settings->getProperties().keys()) { Q_FOREACH (const QString & key, settings->getProperties().keys()) {
if (key.startsWith("Texture") && key != "Texture/Pattern/Enabled") { if (key.startsWith("Texture") && key != "Texture/Pattern/Enabled") {
settings->removeProperty(key); settings->removeProperty(key);
} }
......
...@@ -45,7 +45,7 @@ KisPaintOpRegistry::KisPaintOpRegistry() ...@@ -45,7 +45,7 @@ KisPaintOpRegistry::KisPaintOpRegistry()
KisPaintOpRegistry::~KisPaintOpRegistry() KisPaintOpRegistry::~KisPaintOpRegistry()
{ {
foreach(const QString & id, keys()) { Q_FOREACH (const QString & id, keys()) {
delete get(id); delete get(id);
} }
dbgRegistry << "Deleting KisPaintOpRegistry"; dbgRegistry << "Deleting KisPaintOpRegistry";
...@@ -58,7 +58,7 @@ void KisPaintOpRegistry::initRegistry() ...@@ -58,7 +58,7 @@ void KisPaintOpRegistry::initRegistry()
QStringList toBeRemoved; QStringList toBeRemoved;
foreach(const QString & id, keys()) { Q_FOREACH (const QString & id, keys()) {
KisPaintOpFactory *factory = get(id); KisPaintOpFactory *factory = get(id);
if (!factory->settings()) { if (!factory->settings()) {
toBeRemoved << id; toBeRemoved << id;
...@@ -66,7 +66,7 @@ void KisPaintOpRegistry::initRegistry() ...@@ -66,7 +66,7 @@ void KisPaintOpRegistry::initRegistry()
factory->processAfterLoading(); factory->processAfterLoading();
} }
} }
foreach(const QString & id, toBeRemoved) { Q_FOREACH (const QString & id, toBeRemoved) {
remove(id); remove(id);
} }
} }
...@@ -165,7 +165,7 @@ QString KisPaintOpRegistry::pixmap(const KoID & id) const ...@@ -165,7 +165,7 @@ QString KisPaintOpRegistry::pixmap(const KoID & id) const
QList<KoID> KisPaintOpRegistry::listKeys() const QList<KoID> KisPaintOpRegistry::listKeys() const
{ {
QList<KoID> answer; QList<KoID> answer;
foreach(const QString & key, keys()) { Q_FOREACH (const QString & key, keys()) {
answer.append(KoID(key, get(key)->name())); answer.append(KoID(key, get(key)->name()));
} }
......
...@@ -93,7 +93,7 @@ void KisImageLayerRemoveCommandImpl::Private::processClones(KisNodeSP node) ...@@ -93,7 +93,7 @@ void KisImageLayerRemoveCommandImpl::Private::processClones(KisNodeSP node)
/** /**
* Initialize the list of reincarnates nodes * Initialize the list of reincarnates nodes
*/ */
foreach(KisCloneLayerWSP _clone, layer->registeredClones()) { Q_FOREACH (KisCloneLayerWSP _clone, layer->registeredClones()) {
KisCloneLayerSP clone = _clone; KisCloneLayerSP clone = _clone;
Q_ASSERT(clone); Q_ASSERT(clone);
...@@ -128,7 +128,7 @@ void KisImageLayerRemoveCommandImpl::Private::moveChildren(KisNodeSP src, KisNod ...@@ -128,7 +128,7 @@ void KisImageLayerRemoveCommandImpl::Private::moveChildren(KisNodeSP src, KisNod
void KisImageLayerRemoveCommandImpl::Private::moveClones(KisLayerSP src, KisLayerSP dst) void KisImageLayerRemoveCommandImpl::Private::moveClones(KisLayerSP src, KisLayerSP dst)
{ {
foreach(KisCloneLayerWSP _clone, src->registeredClones()) { Q_FOREACH (KisCloneLayerWSP _clone, src->registeredClones()) {
KisCloneLayerSP clone = _clone; KisCloneLayerSP clone = _clone;
Q_ASSERT(clone); Q_ASSERT(clone);
......
...@@ -57,13 +57,13 @@ void KisNodePropertyListCommand::doUpdate(const KisNodeModel::PropertyList &oldP ...@@ -57,13 +57,13 @@ void KisNodePropertyListCommand::doUpdate(const KisNodeModel::PropertyList &oldP
bool oldPassThroughValue = false; bool oldPassThroughValue = false;
bool newPassThroughValue = false; bool newPassThroughValue = false;
foreach(const KisNodeModel::Property &prop, oldPropertyList) { Q_FOREACH (const KisNodeModel::Property &prop, oldPropertyList) {
if (prop.name == i18n("Pass Through")) { if (prop.name == i18n("Pass Through")) {
oldPassThroughValue = prop.state.toBool(); oldPassThroughValue = prop.state.toBool();
} }
} }
foreach(const KisNodeModel::Property &prop, newPropertyList) { Q_FOREACH (const KisNodeModel::Property &prop, newPropertyList) {
if (prop.name == i18n("Pass Through")) { if (prop.name == i18n("Pass Through")) {
newPassThroughValue = prop.state.toBool(); newPassThroughValue = prop.state.toBool();
} }
...@@ -83,7 +83,7 @@ void KisNodePropertyListCommand::doUpdate(const KisNodeModel::PropertyList &oldP ...@@ -83,7 +83,7 @@ void KisNodePropertyListCommand::doUpdate(const KisNodeModel::PropertyList &oldP
void KisNodePropertyListCommand::setNodePropertiesNoUndo(KisNodeSP node, KisImageSP image, PropertyList proplist) void KisNodePropertyListCommand::setNodePropertiesNoUndo(KisNodeSP node, KisImageSP image, PropertyList proplist)
{ {
bool undo = true; bool undo = true;
foreach(const KisNodeModel::Property &prop, proplist) { Q_FOREACH (const KisNodeModel::Property &prop, proplist) {
if (prop.name == i18n("Visible") && node->visible() != prop.state.toBool()) undo = false; if (prop.name == i18n("Visible") && node->visible() != prop.state.toBool()) undo = false;
if (prop.name == i18n("Locked") && node->userLocked() != prop.state.toBool()) undo = false; if (prop.name == i18n("Locked") && node->userLocked() != prop.state.toBool()) undo = false;
if (prop.name == i18n("Active")) { if (prop.name == i18n("Active")) {
......
...@@ -43,7 +43,7 @@ KisFilterRegistry::KisFilterRegistry(QObject *parent) ...@@ -43,7 +43,7 @@ KisFilterRegistry::KisFilterRegistry(QObject *parent)
KisFilterRegistry::~KisFilterRegistry() KisFilterRegistry::~KisFilterRegistry()
{ {
dbgRegistry << "deleting KisFilterRegistry"; dbgRegistry << "deleting KisFilterRegistry";
foreach(KisFilterSP filter, values()) { Q_FOREACH (KisFilterSP filter, values()) {
remove(filter->id()); remove(filter->id());
filter.clear(); filter.clear();
} }
......
...@@ -40,7 +40,7 @@ KisGeneratorRegistry::KisGeneratorRegistry(QObject *parent) ...@@ -40,7 +40,7 @@ KisGeneratorRegistry::KisGeneratorRegistry(QObject *parent)
KisGeneratorRegistry::~KisGeneratorRegistry() KisGeneratorRegistry::~KisGeneratorRegistry()
{ {
foreach(KisGeneratorSP generator, values()) { Q_FOREACH (KisGeneratorSP generator, values()) {
remove(generator->id()); remove(generator->id());
generator.clear(); generator.clear();
} }
......
...@@ -169,7 +169,7 @@ public: ...@@ -169,7 +169,7 @@ public:
prepareRegion += needRectOnSource; prepareRegion += needRectOnSource;
} }
foreach(const QRect &rect, prepareRegion.rects()) { Q_FOREACH (const QRect &rect, prepareRegion.rects()) {
walker.collectRects(srcLayer, rect); walker.collectRects(srcLayer, rect);
merger.startMerge(walker, false); merger.startMerge(walker, false);
} }
......
...@@ -95,7 +95,7 @@ QList<QString> KisBookmarkedConfigurationManager::configurations() const ...@@ -95,7 +95,7 @@ QList<QString> KisBookmarkedConfigurationManager::configurations() const
QMap< QString, QString > m = cfg->entryMap(configEntryGroup()); QMap< QString, QString > m = cfg->entryMap(configEntryGroup());
QList<QString> keys = m.keys(); QList<QString> keys = m.keys();
QList<QString> configsKey; QList<QString> configsKey;
foreach(const QString & key, keys) { Q_FOREACH (const QString & key, keys) {
if (key != KisBookmarkedConfigurationManager::ConfigDefault && key != KisBookmarkedConfigurationManager::ConfigLastUsed) { if (key != KisBookmarkedConfigurationManager::ConfigDefault && key != KisBookmarkedConfigurationManager::ConfigLastUsed) {
configsKey << key; configsKey << key;
} }
......
...@@ -351,7 +351,7 @@ QImage KisCageTransformWorker::runOnQImage(QPointF *newOffset) ...@@ -351,7 +351,7 @@ QImage KisCageTransformWorker::runOnQImage(QPointF *newOffset)
QVector<QPointF> transformedPoints = m_d->calculateTransformedPoints(); QVector<QPointF> transformedPoints = m_d->calculateTransformedPoints();
QRectF dstBounds; QRectF dstBounds;
foreach (const QPointF &pt, transformedPoints) { Q_FOREACH (const QPointF &pt, transformedPoints) {
KisAlgebra2D::accumulateBounds(pt, &dstBounds); KisAlgebra2D::accumulateBounds(pt, &dstBounds);
} }
......
...@@ -45,21 +45,21 @@ int KisCompositeProgressProxy::maximum() const ...@@ -45,21 +45,21 @@ int KisCompositeProgressProxy::maximum() const
void KisCompositeProgressProxy::setValue(int value) void KisCompositeProgressProxy::setValue(int value)
{ {
foreach(KoProgressProxy *proxy, m_uniqueProxies) { Q_FOREACH (KoProgressProxy *proxy, m_uniqueProxies) {
proxy->setValue(value); proxy->setValue(value);
} }
} }
void KisCompositeProgressProxy::setRange(int minimum, int maximum) void KisCompositeProgressProxy::setRange(int minimum, int maximum)
{ {
foreach(KoProgressProxy *proxy, m_uniqueProxies) { Q_FOREACH (KoProgressProxy *proxy, m_uniqueProxies) {
proxy->setRange(minimum, maximum); proxy->setRange(minimum, maximum);
} }
} }
void KisCompositeProgressProxy::setFormat(const QString &format) void KisCompositeProgressProxy::setFormat(const QString &format)
{ {
foreach(KoProgressProxy *proxy, m_uniqueProxies) { Q_FOREACH (KoProgressProxy *proxy, m_uniqueProxies) {
proxy->setFormat(format); proxy->setFormat(format);
} }
} }
......
...@@ -494,7 +494,7 @@ private: ...@@ -494,7 +494,7 @@ private:
fftw_free(m_kernelFFT); fftw_free(m_kernelFFT);
} }
foreach (fftw_complex *channel, m_channelFFT) { Q_FOREACH (fftw_complex *channel, m_channelFFT) {
fftw_free(channel); fftw_free(channel);
} }
m_channelFFT.clear(); m_channelFFT.clear();
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
bool KisCountVisitor::inList(KisNode* node) bool KisCountVisitor::inList(KisNode* node)
{ {
foreach(const QString& nodeType, m_nodeTypes) { Q_FOREACH (const QString& nodeType, m_nodeTypes) {
if (node->inherits(nodeType.toLatin1())) if (node->inherits(nodeType.toLatin1()))
return true; return true;
} }
......
...@@ -410,7 +410,7 @@ bool KisCubicCurve::isNull() const ...@@ -410,7 +410,7 @@ bool KisCubicCurve::isNull() const
{ {
const QList<QPointF> &points = d->data->points; const QList<QPointF> &points = d->data->points;
foreach (const QPointF &pt, points) {