void EditorView::addRootItem ( ::Key *child ) { QListViewItem *childItem = new QListViewItem ( keyTree, child->key ); //childItem->setName ( child->key ); childItem->setPixmap ( 0, KeyMetaInfo::getIcon ( child ) ); if ( KeyMetaInfo::hasChildKeys( child ) ) { QListViewItem *dummy = new QListViewItem ( childItem, "dummy" ); childItem->insertItem ( dummy ); } }
void EditorView::addItem ( QListViewItem *item, ::Key *child ) { //int bnlength = keyGetBaseNameSize ( child ); char baseName[300]; keyGetBaseName ( child, baseName, 300 ); QListViewItem *childItem = new QListViewItem ( item, baseName ); //childItem->setName ( child->key ); childItem->setPixmap ( 0, KeyMetaInfo::getIcon ( child ) ); if ( KeyMetaInfo::hasChildKeys( child ) ) { QListViewItem *dummy = new QListViewItem ( childItem, "dummy" ); childItem->insertItem ( dummy ); } }
void ProcAttachPS::pushLine() { if (m_line.size() < 3) // we need the PID, PPID, and COMMAND columns return; if (m_pidCol < 0) { // create columns if we don't have them yet bool allocate = processList->columns() == 3; // we assume that the last column is the command m_line.pop_back(); for (uint i = 0; i < m_line.size(); i++) { // we don't allocate the PID and PPID columns, // but we need to know where in the ps output they are if (m_line[i] == "PID") { m_pidCol = i; } else if (m_line[i] == "PPID") { m_ppidCol = i; } else if (allocate) { processList->addColumn(m_line[i]); // these columns are normally numbers processList->setColumnAlignment(processList->columns()-1, Qt::AlignRight); } } } else { // insert a line // find the parent process QListViewItem* parent = 0; if (m_ppidCol >= 0 && m_ppidCol < int(m_line.size())) { parent = processList->findItem(m_line[m_ppidCol], 1); } // we assume that the last column is the command QListViewItem* item; if (parent == 0) { item = new QListViewItem(processList, m_line.back()); } else { item = new QListViewItem(parent, m_line.back()); } item->setOpen(true); m_line.pop_back(); int k = 3; for (uint i = 0; i < m_line.size(); i++) { // display the pid and ppid columns' contents in columns 1 and 2 if (int(i) == m_pidCol) item->setText(1, m_line[i]); else if (int(i) == m_ppidCol) item->setText(2, m_line[i]); else item->setText(k++, m_line[i]); } if (m_ppidCol >= 0 && m_pidCol >= 0) { // need PID & PPID for this /* * It could have happened that a process was earlier inserted, * whose parent process is the current process. Such processes * were placed at the root. Here we go through all root items * and check whether we must reparent them. */ QListViewItem* i = processList->firstChild(); while (i != 0) { // advance before we reparent the item QListViewItem* it = i; i = i->nextSibling(); if (it->text(2) == m_line[m_pidCol]) { processList->takeItem(it); item->insertItem(it); } } } } }
OpenTextDlg::OpenTextDlg( QWidget *parent, sword::SWMgr *swordMgr, QPixmap *bibleIcon, QPixmap *commentaryIcon, QPixmap *lexiconIcon ) : QDialog( parent, QString::null, true ) , m_textList( this ) { setCaption( tr( "Open text" ) ); QVBoxLayout *layout = new QVBoxLayout( this ); layout->setMargin( 4 ); layout->addWidget( &m_textList ); m_textList.setRootIsDecorated( true ); m_textList.addColumn( tr( "Icon" ) ); m_textList.addColumn( tr( "Text" ) ); m_textList.header()->hide(); m_textList.setAllColumnsShowFocus( true ); m_textList.setSorting( 1 ); m_commentaries = new QListViewItem( &m_textList, QString::null, tr( "Commentaries" ) ); m_commentaries->setPixmap( 0, *commentaryIcon ); m_textList.insertItem( m_commentaries ); m_lexicons = new QListViewItem( &m_textList, QString::null, tr( "Lexicons/Dictionaries" ) ); m_lexicons->setPixmap( 0, *lexiconIcon ); m_textList.insertItem( m_lexicons ); m_bibles = new QListViewItem( &m_textList, QString::null, tr( "Biblical Texts" ) ); m_bibles->setPixmap( 0, *bibleIcon ); m_textList.insertItem( m_bibles ); connect( &m_textList, SIGNAL(clicked(QListViewItem*)), this, SLOT(slotItemClicked(QListViewItem*)) ); if ( swordMgr ) { sword::ModMap::iterator it; QString type; QPixmap *icon = 0x0; QListViewItem *parent = 0x0; for ( it = swordMgr->Modules.begin(); it != swordMgr->Modules.end(); it++ ) { if ( it->second ) { type = it->second->Type(); if ( type == "Biblical Texts" ) { icon = bibleIcon; parent = m_bibles; } else if ( type == "Commentaries" ) { icon = commentaryIcon; parent = m_commentaries; } else if ( type == "Lexicons / Dictionaries" ) { icon = lexiconIcon; parent = m_lexicons; } parent->insertItem( new QListViewItem( parent, QString::null, it->first.c_str() ) ); } } } m_textList.sort(); }
void UISearchPage::recvIO_SearchReply( IOMessage * io ) { if ( m_done == true ) return ; // Order of appearance // // the first time a filename shows up it gets it's own line, // and if it shows up more than once it is reparented. QListViewItem * item = new QListViewItem( m_view ); item->setText( UIPageView::Col_Name, io->find( "name" ) ); item->setText( UIPageView::Col_Bitr, io->find( "bitrate" ) ); item->setText( UIPageView::Col_Size, io->find( "size" ) ); item->setText( UIPageView::Col_Time, io->find( "time" ) ); item->setText( UIPageView::Col_Freq, io->find( "freq" ) ); item->setText( UIPageView::Col_Link, io->find( "speed" ) ); item->setText( UIPageView::Col_Nick, io->find( "nick" ) ); item->setText( UIPageView::Col_Path, io->find( "path" ) ); item->setText( UIPageView::Col_Host, io->find( "host" ) ); // // count gets bumped, title gets updated // incrementCount(); updateTitle(); // // do some bizzare tree m_view stuff ? // QListViewItem * item2 = m_items->find( io->find( "name" ) ); if ( item2 == 0 ) { m_items->replace( io->find( "name" ), item ); } else { QListViewItem * from = 0; if ( item2->text( UIPageView::Col_Path ).isEmpty() == false ) { from = new QListViewItem( m_view ); from->setText( UIPageView::Col_Name, io->find( "name" ) ); from->setOpen( true ); from->setPixmap( UIPageView::Col_Name, m_folder ); // also add this item under parent m_view->takeItem( item2 ); from->insertItem( item2 ); } else { from = item2; } m_view->takeItem( item ); from->insertItem( item ); m_items->replace( io->find( "name" ), from ); } m_view->triggerUpdate(); }