Esempio n. 1
0
void SourceView::updateSourceItems()
{
    setColumnWidth(1, 50);
    setColumnWidth(2, _costType2 ? 50:0);
    // Allow resizing of column 2
    setColumnWidthMode(2, QListView::Maximum);
    
    if (_costType)
      setColumnText(1, _costType->name());
    if (_costType2)
      setColumnText(2, _costType2->name());

    SourceItem* si;
    QListViewItem* item  = firstChild();
    for (;item;item = item->nextSibling()) {
	si = (SourceItem*)item;
	TraceLine* l = si->line();
	if (!l) continue;

	si->updateCost();

	QListViewItem *next, *i  = si->firstChild();
	for (;i;i = next) {
	    next = i->nextSibling();
	    ((SourceItem*)i)->updateCost();
	}
    }

    if (!_costType2) {
      setColumnWidthMode(2, QListView::Manual);
      setColumnWidth(2, 0);
    }
}
QgsIdentifyResults::QgsIdentifyResults( QgsMapCanvas *canvas, QWidget *parent, Qt::WFlags f )
    : QDialog( parent, f ),
    mActionPopup( 0 ),
    mCanvas( canvas ),
    mDock( NULL )
{
  setupUi( this );
  QSettings mySettings;
  restoreGeometry( mySettings.value( "/Windows/Identify/geometry" ).toByteArray() );
  bool myDockFlag = mySettings.value( "/qgis/dockIdentifyResults", false ).toBool();
  if ( myDockFlag )
  {
    mDock = new QgsIdentifyResultsDock( tr( "Identify Results" ) , QgisApp::instance() );
    mDock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
    mDock->setWidget( this );
    QgisApp::instance()->addDockWidget( Qt::LeftDockWidgetArea, mDock );
  }
  lstResults->setColumnCount( 2 );
  setColumnText( 0, tr( "Feature" ) );
  setColumnText( 1, tr( "Value" ) );

  connect( buttonBox, SIGNAL( rejected() ), this, SLOT( close() ) );

  connect( lstResults, SIGNAL( itemExpanded( QTreeWidgetItem* ) ),
           this, SLOT( itemExpanded( QTreeWidgetItem* ) ) );

  connect( lstResults, SIGNAL( currentItemChanged( QTreeWidgetItem*, QTreeWidgetItem* ) ),
           this, SLOT( handleCurrentItemChanged( QTreeWidgetItem*, QTreeWidgetItem* ) ) );

  connect( lstResults, SIGNAL( itemClicked( QTreeWidgetItem*, int ) ),
           this, SLOT( itemClicked( QTreeWidgetItem*, int ) ) );
}
Esempio n. 3
0
/*!
  Display relation title and loaded-set count in the listview
  headings.

*/
void QmvList::updateHeading()
{
    setColumnText( 0, tr( editor->shuttleClass()->relationTitle() ) );
    QString ctlabel;
    ctlabel.sprintf("%d rows",editor->shuttleClass()->count());
    setColumnText( 1, tr( ctlabel) );
}
Esempio n. 4
0
void UIListView::setColumnVisible( int col, bool show )
{
        if ( columnVisible( col ) == show )
                return ;

        ColumnData * data = m_data.find( col );

        if ( show == false )
        {
                data->name = columnText( col );
                data->size = columnWidth( col );
                data->mode = columnWidthMode( col );

                setColumnText ( col, "" );
                setColumnWidth( col, 0 );
                setColumnWidthMode( col, QListView::Manual );
                header()->setResizeEnabled( false, col );
        }
        else
        {
                setColumnText ( col, data->name );
                setColumnWidth( col, data->size );
                setColumnWidthMode( col, data->mode );
                header()->setResizeEnabled( true, col );
        }
}
Esempio n. 5
0
PhraseLV::PhraseLV( QWidget *parent, const char *name )
    : QListView( parent, name )
{
    setAllColumnsShowFocus( TRUE );
    setShowSortIndicator( TRUE );
    for ( int i = 0; i < 3; i++ )
	addColumn( QString::null, 120 );
    setColumnText( PhraseLVI::SourceTextShown, tr("Source phrase") );
    setColumnText( PhraseLVI::TargetTextShown, tr("Translation") );
    setColumnText( PhraseLVI::DefinitionText, tr("Definition") );
    header()->setStretchEnabled( TRUE, -1 );
    what = new WhatPhrase( this );
}
QgsIdentifyResultsDialog::QgsIdentifyResultsDialog( QgsMapCanvas *canvas, QWidget *parent, Qt::WFlags f )
    : QDialog( parent, f )
    , mActionPopup( 0 )
    , mCanvas( canvas )
    , mDock( NULL )
{
  setupUi( this );

  mExpandToolButton->setIcon( QgsApplication::getThemeIcon( "/mActionExpandTree.png" ) );
  mCollapseToolButton->setIcon( QgsApplication::getThemeIcon( "/mActionCollapseTree.png" ) );
  mExpandNewToolButton->setIcon( QgsApplication::getThemeIcon( "/mActionExpandNewTree.png" ) );
  mCopyToolButton->setIcon( QgsApplication::getThemeIcon( "/mActionEditCopy.png" ) );
  mPrintToolButton->setIcon( QgsApplication::getThemeIcon( "/mActionFilePrint.png" ) );

  QSettings mySettings;
  restoreGeometry( mySettings.value( "/Windows/Identify/geometry" ).toByteArray() );
  bool myDockFlag = mySettings.value( "/qgis/dockIdentifyResults", false ).toBool();
  if ( myDockFlag )
  {
    mDock = new QgsIdentifyResultsDock( tr( "Identify Results" ) , QgisApp::instance() );
    mDock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
    mDock->setWidget( this );
    QgisApp::instance()->addDockWidget( Qt::LeftDockWidgetArea, mDock );
  }
  mExpandNewToolButton->setChecked( mySettings.value( "/Map/identifyExpand", false ).toBool() );
  mCopyToolButton->setEnabled( false );
  lstResults->setColumnCount( 2 );
  setColumnText( 0, tr( "Feature" ) );
  setColumnText( 1, tr( "Value" ) );

  int width = mySettings.value( "/Windows/Identify/columnWidth", "0" ).toInt();
  if ( width > 0 )
  {
    lstResults->setColumnWidth( 0, width );
  }

  connect( buttonBox, SIGNAL( rejected() ), this, SLOT( close() ) );

  connect( lstResults, SIGNAL( itemExpanded( QTreeWidgetItem* ) ),
           this, SLOT( itemExpanded( QTreeWidgetItem* ) ) );

  connect( lstResults, SIGNAL( currentItemChanged( QTreeWidgetItem*, QTreeWidgetItem* ) ),
           this, SLOT( handleCurrentItemChanged( QTreeWidgetItem*, QTreeWidgetItem* ) ) );

  connect( lstResults, SIGNAL( itemClicked( QTreeWidgetItem*, int ) ),
           this, SLOT( itemClicked( QTreeWidgetItem*, int ) ) );

  connect( mPrintToolButton, SIGNAL( clicked() ),
           this, SLOT( printCurrentItem() ) );
}
Esempio n. 7
0
void BrowserView::set_project(QDir di) {
  dir = di;
  new BrowserNode(this, dir.dirName() + ".prj");
  setRootIsDecorated(TRUE/*FALSE*/);
  
  di.cdUp();
  setColumnText(0, di.path());
}
Esempio n. 8
0
void FXTabSim::reiniciar(void) {
	FXint i;

	limpiar();
	clearItems();

	setTableSize(10,9);

	for ( i = 0; i < 9; i++ )
		setColumnText(i, cabecera[i]);

	tope = -1;
	numRegs = 0;

	bloques->clear();
	}
Esempio n. 9
0
void OutlineTree::getHeaderInformation( const QDomElement &header )
{
    // visit all children of the header element and look if you can make
    // something with it
    QDomNode node = header.firstChild();
    while ( !node.isNull() ) {
	if ( node.isElement() ) {
	    // case for the different header entries
	    if ( node.nodeName() == "title" ) {
		QDomText textChild = node.firstChild().toText();
		if ( !textChild.isNull() ) {
		    setColumnText( 0, textChild.nodeValue() );
		}
	    }
	}
	node = node.nextSibling();
    }
}
Esempio n. 10
0
FXTabSim::FXTabSim(FXComposite *p, FXObject *tgt, FXSelector sel, FXuint opts, FXint x
	, FXint y, FXint w, FXint h, FXint pl, FXint pr, FXint pt, FXint pb) : FXTable(p, tgt
	, sel, opts, x, y, w, h, pl, pr, pt, pb)
	{
	FXint i;
	FXint *clave;

	setTableSize(10,9);

	for ( i = 0; i < 9; i++ )
		setColumnText(i, cabecera[i]);

	tope = -1;
	numRegs = 0;
	bloque = -1;

	bloques = new FXArray<FXint>;

	colores.size(14);
	}
Esempio n. 11
0
void ListProgress::applySettings()
{
    int iEnabledCols = 0;

    // Update listcolumns to show
    for(int i = 0; i < TB_MAX; i++)
    {
        if(!m_lpcc[i].enabled)
            continue;

        iEnabledCols++;

        // Add new or reuse existing column
        if(iEnabledCols > columns())
            m_lpcc[i].index = addColumn(m_lpcc[i].title, m_fixedColumnWidths ? m_lpcc[i].width : -1);
        else
        {
            m_lpcc[i].index = iEnabledCols - 1;
            setColumnText(m_lpcc[i].index, m_lpcc[i].title);
        }

        setColumnWidth(m_lpcc[i].index, m_lpcc[i].width); // yes, this is required here, alexxx
        if(m_fixedColumnWidths)
            setColumnWidthMode(m_lpcc[i].index, Manual);
    }

    // Remove unused columns. However we must keep one column left
    // Otherwise the listview will be emptied
    while(iEnabledCols < columns() && columns() > 1)
        removeColumn(columns() - 1);

    if(columns() == 0)
        addColumn("");

    if(!m_showHeader || iEnabledCols == 0)
        header()->hide();
    else
        header()->show();
}
Esempio n. 12
0
/* If sourceList is empty we set the source file name into the header,
 * else this code is of a inlined function, and we add "inlined from..."
 */
void SourceView::fillSourceFile(TraceFunctionSource* sf, int fileno)
{
  if (!sf) return;

  if (0) qDebug("Selected Item %s", 
		_selectedItem ? _selectedItem->name().ascii() : "(none)");

  TraceLineMap::Iterator lineIt, lineItEnd;
  int nextCostLineno = 0, lastCostLineno = 0;

  bool validSourceFile = (!sf->file()->name().isEmpty());

  TraceLine* sLine = 0;
  if (_selectedItem) {
    if (_selectedItem->type() == TraceItem::Line)
      sLine = (TraceLine*) _selectedItem;
    if (_selectedItem->type() == TraceItem::Instr)
      sLine = ((TraceInstr*)_selectedItem)->line();
  }

  if (validSourceFile) {
      TraceLineMap* lineMap = sf->lineMap();
      if (lineMap) {
	  lineIt    = lineMap->begin();
	  lineItEnd = lineMap->end();
	  // get first line with cost of selected type
	  while(lineIt != lineItEnd) {
	    if (&(*lineIt) == sLine) break;
	    if ((*lineIt).hasCost(_costType)) break;
	    if (_costType2 && (*lineIt).hasCost(_costType2)) break;
	    ++lineIt;
	  }

	  nextCostLineno     = (lineIt == lineItEnd) ? 0 : (*lineIt).lineno();
	  if (nextCostLineno<0) {
	    kdError() << "SourceView::fillSourceFile: Negative line number "
		      << nextCostLineno << endl
		      << "  Function '" << sf->function()->name() << "'" << endl
		      << "  File '" << sf->file()->name() << "'" << endl;
	    nextCostLineno = 0;
	  }
	    
      }

      if (nextCostLineno == 0) {
	  new SourceItem(this, this, fileno, 0, false,
			 i18n("There is no cost of current selected type associated"));
	  new SourceItem(this, this, fileno, 1, false,
			 i18n("with any source line of this function in file"));
	  new SourceItem(this, this, fileno, 2, false,
			 QString("    '%1'").arg(sf->function()->prettyName()));
	  new SourceItem(this, this, fileno, 3, false,
			 i18n("Thus, no annotated source can be shown."));
	  return;
      }
  }

  QString filename = sf->file()->shortName();
  QString dir = sf->file()->directory();
  if (!dir.isEmpty())
    filename = dir + "/" + filename;

  if (nextCostLineno>0) {
    // we have debug info... search for source file
    if (!QFile::exists(filename)) {
      QStringList list = Configuration::sourceDirs(_data,
						   sf->function()->object());
      QStringList::Iterator it;

      for ( it = list.begin(); it != list.end(); ++it ) {
        dir = *it;
        if (checkFileExistance(dir, sf->file()->shortName())) break;
      }

      if (it == list.end())
	  nextCostLineno = 0;
      else {
        filename = dir + "/" + sf->file()->shortName();
        // no need to search again
        sf->file()->setDirectory(dir);
      }
    }
  }

  // do it here, because the source directory could have been set before
  if (childCount()==0) {
    setColumnText(4, validSourceFile ?
                  i18n("Source ('%1')").arg(filename) :
                  i18n("Source (unknown)"));
  }
  else {
    new SourceItem(this, this, fileno, 0, true,
                   validSourceFile ?
                   i18n("--- Inlined from '%1' ---").arg(filename) :
                   i18n("--- Inlined from unknown source ---"));
  }

  if (nextCostLineno == 0) {
    new SourceItem(this, this, fileno, 0, false,
                   i18n("There is no source available for the following function:"));
    new SourceItem(this, this, fileno, 1, false,
                   QString("    '%1'").arg(sf->function()->prettyName()));
    if (sf->file()->name().isEmpty()) {
      new SourceItem(this, this, fileno, 2, false,
                     i18n("This is because no debug information is present."));
      new SourceItem(this, this, fileno, 3, false,
                     i18n("Recompile source and redo the profile run."));
      if (sf->function()->object()) {
        new SourceItem(this, this, fileno, 4, false,
                       i18n("The function is located in this ELF object:"));
        new SourceItem(this, this, fileno, 5, false,
                       QString("    '%1'")
                       .arg(sf->function()->object()->prettyName()));
      }
    }
    else {
      new SourceItem(this, this, fileno, 2, false,
                     i18n("This is because its source file cannot be found:"));
      new SourceItem(this, this, fileno, 3, false,
                     QString("    '%1'").arg(sf->file()->name()));
      new SourceItem(this, this, fileno, 4, false,
                     i18n("Add the folder of this file to the source folder list."));
      new SourceItem(this, this, fileno, 5, false,
                     i18n("The list can be found in the configuration dialog."));
    }
    return;
  }


  // initialisation for arrow drawing
  // create sorted list of jumps (for jump arrows)
  TraceLineMap::Iterator it = lineIt, nextIt;
  _lowList.clear();
  _highList.clear();
  while(1) {

      nextIt = it;
      ++nextIt;
      while(nextIt != lineItEnd) {
	if (&(*nextIt) == sLine) break;
	if ((*nextIt).hasCost(_costType)) break;
	if (_costType2 && (*nextIt).hasCost(_costType2)) break;
	++nextIt;
      }

      TraceLineJumpList jlist = (*it).lineJumps();
      TraceLineJump* lj;
      for (lj=jlist.first();lj;lj=jlist.next()) {
	  if (lj->executedCount()==0) continue;
	  // skip jumps to next source line with cost
	  //if (lj->lineTo() == &(*nextIt)) continue;

	  _lowList.append(lj);
	  _highList.append(lj);
      }
      it = nextIt;
      if (it == lineItEnd) break;
  }
  _lowList.sort();
  _highList.sort();
  _lowList.first(); // iterators to list start
  _highList.first();
  _jump.resize(0);


  char buf[256];
  bool inside = false, skipLineWritten = true;
  int readBytes;
  int fileLineno = 0;
  SubCost most = 0;

  TraceLine* currLine;
  SourceItem *si, *si2, *item = 0, *first = 0, *selected = 0;
  QFile file(filename);
  if (!file.open(IO_ReadOnly)) return;
  while (1) {
    readBytes=file.readLine(buf, sizeof( buf ));
    if (readBytes<=0) {
      // for nice empty 4 lines after function with EOF
      buf[0] = 0;
    }

    if (readBytes >= (int) sizeof( buf )) {
      qDebug("%s:%d  Line too long\n",
	     sf->file()->name().ascii(), fileLineno);
    }
    else if ((readBytes>0) && (buf[readBytes-1] == '\n'))
      buf[readBytes-1] = 0;


    // keep fileLineno inside [lastCostLineno;nextCostLineno]
    fileLineno++;
    if (fileLineno == nextCostLineno) {
	currLine = &(*lineIt);

	// get next line with cost of selected type
	++lineIt;
	while(lineIt != lineItEnd) {
	  if (&(*lineIt) == sLine) break;
	  if ((*lineIt).hasCost(_costType)) break;
	  if (_costType2 && (*lineIt).hasCost(_costType2)) break;
	  ++lineIt;
	}

	lastCostLineno = nextCostLineno;
	nextCostLineno = (lineIt == lineItEnd) ? 0 : (*lineIt).lineno();
    }
    else
	currLine = 0;

    // update inside
    if (!inside) {
	if (currLine) inside = true;
    }
    else {
	if ( (fileLineno > lastCostLineno) &&
	     ((nextCostLineno == 0) ||
	      (fileLineno < nextCostLineno - Configuration::noCostInside()) ))
	    inside = false;
    }

    int context = Configuration::context();

    if ( ((lastCostLineno==0) || (fileLineno > lastCostLineno + context)) &&
	 ((nextCostLineno==0) || (fileLineno < nextCostLineno - context))) {
	if (lineIt == lineItEnd) break;

	if (!skipLineWritten) {
	    skipLineWritten = true;
	    // a "skipping" line: print "..." instead of a line number
	    strcpy(buf,"...");
	}
	else
	    continue;
    }
    else
	skipLineWritten = false;

    si = new SourceItem(this, this, 
			fileno, fileLineno, inside, QString(buf),
                        currLine);

    if (!currLine) continue;

    if (!selected && (currLine == sLine)) selected = si;
    if (!first) first = si;

    if (currLine->subCost(_costType) > most) {
      item = si;
      most = currLine->subCost(_costType);
    }

    si->setOpen(true);
    TraceLineCallList list = currLine->lineCalls();
    TraceLineCall* lc;
    for (lc=list.first();lc;lc=list.next()) {
	if ((lc->subCost(_costType)==0) &&
	    (lc->subCost(_costType2)==0)) continue;

      if (lc->subCost(_costType) > most) {
        item = si;
        most = lc->subCost(_costType);
      }

      si2 = new SourceItem(this, si, fileno, fileLineno, currLine, lc);

      if (!selected && (lc->call()->called() == _selectedItem))
	  selected = si2;
    }

    TraceLineJumpList jlist = currLine->lineJumps();
    TraceLineJump* lj;
    for (lj=jlist.first();lj;lj=jlist.next()) {
	if (lj->executedCount()==0) continue;

	new SourceItem(this, si, fileno, fileLineno, currLine, lj);
    }
  }

  if (selected) item = selected;
  if (item) first = item;
  if (first) {
      ensureItemVisible(first);
      _inSelectionUpdate = true;
      setCurrentItem(first);
      _inSelectionUpdate = false;
  }

  file.close();

  // for arrows: go down the list according to list sorting
  sort();
  QListViewItem *item1, *item2;
  for (item1=firstChild();item1;item1 = item1->nextSibling()) {
      si = (SourceItem*)item1;
      updateJumpArray(si->lineno(), si, true, false);

      for (item2=item1->firstChild();item2;item2 = item2->nextSibling()) {
	  si2 = (SourceItem*)item2;
	  if (si2->lineJump())
	      updateJumpArray(si->lineno(), si2, false, true);
	  else
	      si2->setJumpArray(_jump);
      }
  }

  if (arrowLevels())
      setColumnWidth(3, 10 + 6*arrowLevels() + itemMargin() * 2);
  else
      setColumnWidth(3, 0);
}
Esempio n. 13
0
void SourceView::refresh()
{
  clear();
  setColumnWidth(0, 20);
  setColumnWidth(1, 50);
  setColumnWidth(2, _costType2 ? 50:0);
  setColumnWidth(3, 0); // arrows, defaults to invisible
  setSorting(0); // always reset to line number sort
  if (_costType)
    setColumnText(1, _costType->name());
  if (_costType2)
    setColumnText(2, _costType2->name());

  _arrowLevels = 0;

  if (!_data || !_activeItem) {
    setColumnText(4, i18n("(No Source)"));
    return;
  }

  TraceItem::CostType t = _activeItem->type();
  TraceFunction* f = 0;
  if (t == TraceItem::Function) f = (TraceFunction*) _activeItem;
  if (t == TraceItem::Instr) {
    f = ((TraceInstr*)_activeItem)->function();
    if (!_selectedItem) _selectedItem = _activeItem;
  }
  if (t == TraceItem::Line) {
    f = ((TraceLine*)_activeItem)->functionSource()->function();
    if (!_selectedItem) _selectedItem = _activeItem;
  }

  if (!f) return;

  // Allow resizing of column 2
  setColumnWidthMode(2, QListView::Maximum);

  TraceFunctionSource* mainSF = f->sourceFile();

  // skip first source if there's no debug info and there are more sources
  // (this is for a bug in GCC 2.95.x giving unknown source for prologs)
  if (mainSF &&
      (mainSF->firstLineno() == 0) &&
      (mainSF->lastLineno() == 0) &&
      (f->sourceFiles().count()>1) ) {
	  // skip
  }
  else
      fillSourceFile(mainSF, 0);

  TraceFunctionSource* sf;
  int fileno = 1;
  TraceFunctionSourceList l = f->sourceFiles();
  for (sf=l.first();sf;sf=l.next(), fileno++)
    if (sf != mainSF)
      fillSourceFile(sf, fileno);

  if (!_costType2) {
    setColumnWidthMode(2, QListView::Manual);
    setColumnWidth(2, 0);
  }
}