void PsiToolBar::initialize( QString base, bool createUniqueActions ) { d->base = base; d->uniqueActions.clear(); // PsiOptions::instance()->getOption(base + ".").toString() // setHorizontallyStretchable(PsiOptions::instance()->getOption(base + ".stretchable").toBool()); // setVerticallyStretchable(PsiOptions::instance()->getOption(base + ".stretchable").toBool()); setMovable (!PsiOptions::instance()->getOption(base + ".locked").toBool()); if ( d->psi ) { ActionList actions = d->psi->actionList()->suitableActions( d->type ); QStringList keys = PsiOptions::instance()->getOption(base + ".actions").toStringList(); for (int j = 0; j < keys.size(); j++) { IconAction *action = actions.action( keys[j] ); if ( action && action->isSeparator() ) { addSeparator(); } else if ( action ) { if ( createUniqueActions ) { action = action->copy(); d->uniqueActions.append( action ); } action->addTo( this ); emit registerAction( action ); } else { qWarning("PsiToolBar::initialize(): action %s not found!", keys[j].latin1()); } } } else { qWarning("PsiToolBar::initialize(): psi is NULL!"); } if (PsiOptions::instance()->getOption(base + ".visible").toBool()) { show(); } else { hide(); } }
void PsiToolBar::initialize( Options::ToolbarPrefs &tbPref, bool createUniqueActions ) { d->uniqueActions.clear(); setHorizontallyStretchable( tbPref.stretchable ); setVerticallyStretchable( tbPref.stretchable ); setMovingEnabled ( !tbPref.locked ); if ( d->psi ) { ActionList actions = d->psi->actionList()->suitableActions( d->type ); QStringList keys = tbPref.keys; for (int j = 0; j < keys.size(); j++) { IconAction *action = actions.action( keys[j] ); if ( action && action->isSeparator() ) { addSeparator(); } else if ( action ) { if ( createUniqueActions ) { action = action->copy(); d->uniqueActions.append( action ); } action->addTo( this ); emit registerAction( action ); } else qWarning("PsiToolBar::initialize(): action %s not found!", keys[j].latin1()); } } else qWarning("PsiToolBar::initialize(): psi is NULL!"); if ( tbPref.on ) show(); else hide(); tbPref.dirty = false; }