X-Git-Url: https://git.sven.stormbind.net/?a=blobdiff_plain;f=flagrow.cpp;fp=flagrow.cpp;h=0000000000000000000000000000000000000000;hb=d483bd8e6523c23c6f1d8908a2e0611c2bc9ff4f;hp=f2b85082d467fde3d5454109b1d88333d701f832;hpb=7dfa3fe589d1722d49681f42cdb0bf1e6efb5223;p=sven%2Fvym.git diff --git a/flagrow.cpp b/flagrow.cpp deleted file mode 100644 index f2b8508..0000000 --- a/flagrow.cpp +++ /dev/null @@ -1,208 +0,0 @@ -#include - -#include "flagrow.h" - -extern bool debug; - -///////////////////////////////////////////////////////////////// -// FlagRow -///////////////////////////////////////////////////////////////// -FlagRow::FlagRow() -{ - toolBar=NULL; - masterRow=NULL; -// qDebug()<< "Const FlagRow ()"; -} - -FlagRow::~FlagRow() -{ - //qDebug()<< "Destr FlagRow"; -} - -void FlagRow::addFlag (Flag *flag) -{ - Flag *f=new Flag; -; - f->copy (flag); - flags.append (f); - activeNames.append (flag->getName()); -} - -Flag* FlagRow::getFlag (const QString &name) -{ - int i=0; - while (i<=flags.size()-1) - { - if (flags.at(i)->getName()==name) - return flags.at(i); - i++; - } - return NULL; -} - -QStringList FlagRow::activeFlagNames() -{ - return activeNames; -} - - -bool FlagRow::isActive (const QString &name) -{ - QString n; - foreach (n,activeNames) - if (n==name) return true; - return false; -} - -bool FlagRow::toggle (const QString &name, FlagRow *masterRow) -{ - if (isActive(name) ) - return deactivate (name); - else - { - if (!activate (name) ) return false; - - // Deactivate group - if (!masterRow) return false; - - Flag *flag=masterRow->getFlag (name); - if (!flag) return false; - QString mygroup=flag->getGroup(); - - for (int i=0;igetFlag (activeNames.at(i) ); - if (name!=activeNames.at(i) && !mygroup.isEmpty() && mygroup==flag->getGroup()) - deactivate (activeNames.at(i)); - } - return true; - } -} - -bool FlagRow::activate (const QString &name) -{ - if (isActive (name)) - { - if (debug) qWarning ()<getFlag (name); - if (!flag) - { - qWarning()<<"FlagRow::activate - flag "<=0) - { - activeNames.removeAt(n); - return true; - } - if (debug) - qWarning ()<getFlag (s); - if (flag && gname == flag->getGroup()) - deactivate (s); - } - return true; -} - -void FlagRow::deactivateAll () -{ - if (!toolBar) activeNames.clear(); -} - -void FlagRow::setEnabled (bool b) -{ - toolBar->setEnabled (b); -} - -void FlagRow::resetUsedCounter() -{ - for (int i=0; isetUsed (false); -} - -QString FlagRow::saveToDir (const QString &tmpdir,const QString &prefix, bool writeflags) -{ - // Build xml string - QString s; - - if (!toolBar) - { - if (!activeNames.isEmpty()) - for (int i=0; igetFlag(activeNames.at(i))->setUsed(true); - } - } else - // Save icons to dir, if verbose is set (xml export) - // and I am a master - // and this flag is really used somewhere - if (writeflags) - for (int i=0; iisUsed()) flags.at(i)->saveToDir (tmpdir,prefix); - return s; -} - -void FlagRow::setName (const QString &n) -{ - rowName=n; -} - -void FlagRow::setToolBar (QToolBar *tb) -{ - toolBar=tb; -} - -void FlagRow::setMasterRow (FlagRow *row) -{ - masterRow=row; -} - -void FlagRow::updateToolBar (const QStringList &activeNames) -{ - if (toolBar ) - { - for (int i=0;igetAction()->setChecked (false); - for (int i=0;igetName()); - if (n>=0) - flags.at(i)->getAction()->setChecked (true); - } - } -} - -