diff -r a4532e5c2ce3 -r 1c8ff1928b97 flagrowobj.cpp --- a/flagrowobj.cpp Mon Nov 20 12:12:05 2006 +0000 +++ b/flagrowobj.cpp Thu Nov 23 13:53:08 2006 +0000 @@ -19,13 +19,13 @@ FlagRowObj::~FlagRowObj() { -// cout << "Destr FlagRowObj\n"; - flag.clear(); + // cout << "Destr FlagRowObj\n"; + while (!flag.isEmpty()) + delete flag.takeFirst(); } void FlagRowObj::init () { - flag.setAutoDelete (true); parentRow=NULL; showFlags=true; } @@ -35,9 +35,8 @@ MapObj::copy(other); parentRow=other->parentRow; flag.clear(); - FlagObj *fo; - for (fo=other->flag.first(); fo; fo=other->flag.next() ) - addFlag (fo); + for (int i=0; imove(x+dx,y); - dx+=QSize(fo->getSize() ).width(); + flag.at(i)->move(x+dx,y); + dx+=QSize(flag.at(i)->getSize() ).width(); } } @@ -71,9 +69,8 @@ void FlagRowObj::setVisibility (bool v) { MapObj::setVisibility(v); - FlagObj *fo; - for (fo=flag.first(); fo; fo=flag.next() ) - fo->setVisibility (v); + for (int i=0; isetVisibility (v); } FlagObj* FlagRowObj::addFlag (FlagObj *fo) @@ -97,10 +94,9 @@ { QSize size(0,0); QSize boxsize(0,0); - FlagObj *fo; - for (fo=flag.first(); fo; fo=flag.next() ) + for (int i=0; igetSize(); + size=flag.at(i)->getSize(); // add widths boxsize.setWidth(boxsize.width() + size.width() ); // maximize height @@ -114,9 +110,8 @@ QString FlagRowObj::getFlagName (const QPoint &p) { if (!inBox (p)) return ""; - FlagObj *fo; - for (fo=flag.first();fo; fo=flag.next() ) - if (fo->inBox (p)) return fo->getName(); + for (int i=0; iinBox (p)) return flag.at(i)->getName(); return ""; @@ -211,9 +206,8 @@ { if (!parentRow) { - FlagObj *fo; - for (fo=flag.first();fo; fo=flag.next() ) - fo->deactivate(); + for (int i=0; ideactivate(); } else qWarning ("FlagRowObj::deactivateAll mustn't be called for ordinary rows"); } @@ -226,10 +220,9 @@ QString g=keepfo->getGroup(); if (g!="undefined") { - FlagObj *fo; - for (fo=flag.first();fo; fo=flag.next() ) - if (g==fo->getGroup() && keepfo!=fo) - flag.remove(fo); + for (int i=0; igetGroup() && keepfo!=flag.at(i)) + flag.remove(flag.at(i)); } } } @@ -254,32 +247,30 @@ void FlagRowObj::resetUsedCounter() { - FlagObj *fo; - for (fo=flag.first();fo; fo=flag.next() ) - fo->setUsed (false); + for (int i=0; isetUsed (false); } QString FlagRowObj::saveToDir (const QString &tmpdir,const QString &prefix, bool writeflags) { // Build xml string QString s; - FlagObj *fo; if (parentRow) - for (fo=flag.first();fo; fo=flag.next() ) + for (int i=0; igetName() ); + s+=valueElement("standardflag",flag.at(i)->getName() ); // and tell parentRow, that this flag is used - parentRow->activate(fo->getName() ); + parentRow->activate(flag.at(i)->getName() ); } else // Save icons to dir, if verbose is set (xml export) // and I am a parentRow // and this flag is really used somewhere if (writeflags) - for (fo=flag.first();fo; fo=flag.next() ) - if (fo->isUsed()) fo->saveToDir (tmpdir,prefix); + for (int i=0; iisUsed()) flag.at(i)->saveToDir (tmpdir,prefix); return s; } @@ -291,15 +282,14 @@ void FlagRowObj::updateToolbar() { - FlagObj *fo; if (parentRow) { // We are just a branch, not the toolbar default // but state has to be copied from ourselves to parentrow! parentRow->deactivateAll(); // In parentRow activate all existing (==active) flags - for (fo=flag.first();fo; fo=flag.next() ) - parentRow->activate(fo->getName()); + for (int i=0; iactivate(flag.at(i)->getName()); parentRow->updateToolbar(); } else { @@ -307,19 +297,16 @@ if (toolbar) { // Update state of actions in toolbar - for (fo=flag.first();fo; fo=flag.next() ) - fo->updateAction(); + for (int i=0; iupdateAction(); } } } FlagObj* FlagRowObj::findFlag (const QString &name) { - FlagObj *fo; - for (fo=flag.first();fo; fo=flag.next() ) - { - if (fo->getName()==name) return fo; - } + for (int i=0; igetName()==name) return flag.at(i); return NULL; }