Ejemplo n.º 1
0
Kleo::DNAttributeMapper::DNAttributeMapper() {
  d = new Private();
  const KConfigGroup config( kapp->config(), "DN" );
  d->attributeOrder = config.readListEntry( "AttributeOrder" );
  if ( d->attributeOrder.empty() )
    std::copy( defaultOrder, defaultOrder + sizeof defaultOrder / sizeof *defaultOrder,
	       std::back_inserter( d->attributeOrder ) );
  mSelf = this;
}
Ejemplo n.º 2
0
void TabView::readViewConfig(KConfig* c,
			     QString prefix, QString postfix,
			     bool withOptions)
{
    if (0) qDebug("%s::readConfig(%s%s)", name(),
		  prefix.ascii(), postfix.ascii());

    KConfigGroup* g = configGroup(c, prefix, postfix);

    _mainSplitter->setSizes(g->readIntListEntry("MainSizes"));
    _leftSplitter->setSizes(g->readIntListEntry("LeftSizes"));
    _bottomSplitter->setSizes(g->readIntListEntry("BottomSizes"));

    QString activeT = g->readEntry("ActiveTop", "CallerView");
    QString activeB = g->readEntry("ActiveBottom", "CalleeView");
    QString activeL = g->readEntry("ActiveLeft", "");
    QString activeR = g->readEntry("ActiveRight", "");

    QStringList topTabs    = g->readListEntry("TopTabs");
    QStringList bottomTabs = g->readListEntry("BottomTabs");
    QStringList leftTabs   = g->readListEntry("LeftTabs");
    QStringList rightTabs  = g->readListEntry("RightTabs");

    if (topTabs.isEmpty() && bottomTabs.isEmpty() &&
        rightTabs.isEmpty() && leftTabs.isEmpty()) {
      // no tabs visible ?! Reset to default
      topTabs << "CostTypeView" << "CallerView" << "AllCallerView"
              << "CalleeMapView" << "SourceView";
      bottomTabs << "PartView" << "CalleeView" << "CallGraphView"
                 << "AllCalleeView" << "CallerMapView" << "InstrView";
    }

    TraceItemView *activeTop = 0, *activeBottom = 0;
    TraceItemView *activeLeft = 0, *activeRight = 0;

    moveTab(0, TraceItemView::Top, true);
    TraceItemView *v;
    QPtrListIterator<TraceItemView> it( _tabs );
    while ( (v=it.current()) != 0) {
      ++it;

      QString n = QString(v->widget()->name());
      if (topTabs.contains(n)) {
        moveTab(v->widget(), TraceItemView::Top);
        if (n == activeT) activeTop = v;
      }
      else if (bottomTabs.contains(n)) {
        moveTab(v->widget(), TraceItemView::Bottom);
        if (n == activeB) activeBottom = v;
      }
      else if (leftTabs.contains(n)) {
        moveTab(v->widget(), TraceItemView::Left);
        if (n == activeL) activeLeft = v;
      }
      else if (rightTabs.contains(n)) {
        moveTab(v->widget(), TraceItemView::Right);
        if (n == activeR) activeRight = v;
      }
      else moveTab(v->widget(), Hidden);

      if (withOptions)
	v->readViewConfig(c, QString("%1-%2")
			  .arg(prefix).arg(v->widget()->name()),
			  postfix, true);
    }
    if (activeTop)   _topTW->showPage(activeTop->widget());
    if (activeBottom)_bottomTW->showPage(activeBottom->widget());
    if (activeLeft)  _leftTW->showPage(activeLeft->widget());
    if (activeRight) _rightTW->showPage(activeRight->widget());

    QString activeType = g->readEntry("ActiveItemType", "");
    QString activeName = g->readEntry("ActiveItemName", "");
    QString selectedType = g->readEntry("SelectedItemType", "");
    QString selectedName = g->readEntry("SelectedItemName", "");
    delete g;
    
    if (!_data) return;
    
    if (withOptions) {  
      // restore active item
      TraceItem::CostType t = TraceItem::costType(activeType);
      if (t==TraceItem::NoCostType) t = TraceItem::Function;
      TraceCost* activeItem = _data->search(t, activeName, _costType);
      if (!activeItem) return;
      activate(activeItem);
      
      // restore selected item
      t = TraceItem::costType(selectedType);
      if (t==TraceItem::NoCostType) t = TraceItem::Function;
      TraceCost* selectedItem = _data->search(t, selectedName,
					      _costType, activeItem);
      if (selectedItem) select(selectedItem);
    }

    updateView();
}