本文整理汇总了C++中QListViewItem::setText方法的典型用法代码示例。如果您正苦于以下问题:C++ QListViewItem::setText方法的具体用法?C++ QListViewItem::setText怎么用?C++ QListViewItem::setText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListViewItem
的用法示例。
在下文中一共展示了QListViewItem::setText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fill
void ConnectionManager::fill(Client *current)
{
lstConnection->clear();
QListViewItem *curItem = NULL;
for (unsigned i = 0; i < getContacts()->nClients(); i++){
Client *client = getContacts()->getClient(i);
Protocol *protocol = client->protocol();
const CommandDef *descr = protocol->description();
QString text = CorePlugin::m_plugin->clientName(client);
QListViewItem *item = new QListViewItem(lstConnection, text);
if (descr)
item->setPixmap(0, Pict(descr->icon, lstConnection->colorGroup().base()));
if (current == client)
curItem = item;
QString index = QString::number(i);
while (index.length() < 6)
index = QString("0") + index;
item->setText(1, index);
}
if (curItem)
lstConnection->setCurrentItem(curItem);
selectionChanged();
}
示例2: setRoot
/**
* Associates a root directory with this list.
* For each file in the list, the part of the path corresponding to the root
* is replaced with a $ sign.
* @param sRoot The new root path
*/
void FileList::setRoot(const QString& sRoot)
{
QListViewItem* pItem;
QString sPath;
// Update all items in the list
for (pItem = m_pList->firstChild(); pItem != NULL;
pItem = pItem->nextSibling()) {
sPath = pItem->text(2);
// Restore the full path
sPath.replace("$", m_sRoot);
// Replace the root with a $ sign
if (sRoot != "/")
sPath.replace(sRoot, "$");
pItem->setText(2, sPath);
}
// Store the new root
m_sRoot = sRoot;
}
示例3: functionAdd
void EditFunctions::functionAdd( const QString &access, const QString &type )
{
QListViewItem *i = new QListViewItem( functionListView );
i->setPixmap( 0, QPixmap::fromMimeSource( "designer_editslots.png" ) );
i->setRenameEnabled( 0, TRUE );
i->setText( 1, "void" );
i->setText( 2, "virtual" );
if ( access.isEmpty() )
i->setText( 3, "public" );
else
i->setText( 3, access );
if( type.isEmpty() ) {
if ( showOnlySlots->isChecked() )
i->setText( 4, "slot" );
else {
i->setText( 4, lastType );
}
} else {
i->setText( 4, type );
}
if ( i->text( 4 ) == "slot" ) {
i->setText( 0, "newSlot()" );
if ( MetaDataBase::isSlotUsed( formWindow, "newSlot()" ) )
i->setText( 5, tr( "Yes" ) );
else
i->setText( 5, tr( "No" ) );
} else {
i->setText( 0, "newFunction()" );
i->setText( 5, "---" );
}
functionListView->setCurrentItem( i );
functionListView->setSelected( i, TRUE );
functionListView->ensureItemVisible( i );
functionName->setFocus();
functionName->selectAll();
FunctItem fui;
fui.id = id;
fui.oldName = i->text( 0 );
fui.newName = fui.oldName;
fui.oldRetTyp = i->text( 1 );
fui.retTyp = fui.oldRetTyp;
fui.oldSpec = i->text ( 2 );
fui.spec = fui.oldSpec;
fui.oldAccess = i->text( 3 );
fui.access = fui.oldAccess;
fui.oldType = i->text( 4 );
fui.type = fui.oldType;
lastType = fui.oldType;
functList.append( fui );
functionIds.insert( i, id );
id++;
}
示例4: go
void JabberBrowser::go(const QString &url, const QString &node)
{
setNavigation();
Command cmd;
m_list->clear();
cmd->id = CmdBrowseInfo;
cmd->flags = COMMAND_DISABLED;
cmd->param = this;
EventCommandDisabled(cmd).process();
cmd->id = CmdBrowseSearch;
cmd->flags = COMMAND_DISABLED;
cmd->param = this;
EventCommandDisabled(cmd).process();
cmd->id = CmdRegister;
cmd->flags = COMMAND_DISABLED;
cmd->param = this;
EventCommandDisabled(cmd).process();
cmd->id = CmdBrowseConfigure;
cmd->flags = COMMAND_DISABLED;
cmd->param = this;
EventCommandDisabled(cmd).process();
m_bInProcess = true;
QListViewItem *item = new QListViewItem(m_list);
item->setText(COL_JID, url);
item->setText(COL_NAME, url);
item->setText(COL_NODE, node);
m_bError = false;
unsigned mode = 0;
if (JabberPlugin::plugin->getBrowseType() & BROWSE_DISCO){
item->setText(COL_ID_DISCO_ITEMS, m_client->discoItems(url, node));
item->setText(COL_ID_DISCO_INFO, m_client->discoInfo(url, node));
mode = BROWSE_DISCO | BROWSE_INFO;
}
if (JabberPlugin::plugin->getBrowseType() & BROWSE_BROWSE){
if (node.isEmpty()){
item->setText(COL_ID_BROWSE, m_client->browse(url));
mode |= BROWSE_BROWSE;
}
}
item->setText(COL_MODE, QString::number(mode));
item->setPixmap(COL_NAME, Pict("empty"));
cmd->id = CmdUrl;
cmd->param = this;
EventCommandWidget eWidget(cmd);
eWidget.process();
CToolCombo *cmbUrl = dynamic_cast<CToolCombo*>(eWidget.widget());
if (cmbUrl)
cmbUrl->setText(url);
cmd->id = CmdNode;
EventCommandWidget eWidget2(cmd);
eWidget2.process();
CToolCombo *cmbNode = dynamic_cast<CToolCombo*>(eWidget2.widget());
if (cmbNode)
cmbNode->setText(node);
startProcess();
if (item->text(COL_ID_DISCO_INFO).isEmpty())
stop(i18n("Client offline"));
}
示例5:
void k9ProcessList::setText(k9Process *_process, const QString &_text,int _col) {
QListViewItem *it =m_items[_process];
it->setText(_col,_text);
}
示例6: saveCurrentAction
void ActionConfigDialog::saveCurrentAction()
{
static_cast<TagAction *>(currentAction)->setModified(true);
QString s;
QDomElement el = static_cast<TagAction *>(currentAction)->data();
s = actionIcon->icon();
el.setAttribute("icon", s);
currentAction->setIcon(s);
QString oldText = el.attribute("text");
s = lineText->text();
s.replace('&', "&&");
el.setAttribute("text", s);
currentAction->setText(s);
s = lineToolTip->text();
el.setAttribute("tooltip", s);
currentAction->setToolTip(s);
s = "";
if (customShortcut->isChecked())
{
s = selectedShortcut.toString();
currentAction->setShortcut(selectedShortcut);
} else
{
currentAction->setShortcut(KShortcut());
}
el.setAttribute("shortcut", s);
//update the tree view
QListViewItem *listItem;
QListViewItemIterator it(actionTreeView);
while (it.current())
{
listItem = it.current();
if (listItem->depth() > 0 && listItem->text(2) == currentAction->name())
{
listItem->setPixmap(0, SmallIcon(actionIcon->icon()));
listItem->setText(0, lineText->text());
listItem->setText(1, currentAction->shortcut().toString());
}
++it;
}
//remove all the detailed settings
QDomElement item = el.namedItem("tag").toElement();
if ( !item.isNull() )
el.removeChild(item);
item = el.namedItem("tag").toElement();
if ( !item.isNull() )
el.removeChild(item);
item = el.namedItem("xtag").toElement();
if ( !item.isNull() )
el.removeChild(item);
item = el.namedItem("script").toElement();
if ( !item.isNull() )
el.removeChild(item);
item = el.namedItem("text").toElement();
if ( !item.isNull() )
el.removeChild(item);
//add the new detailed settings
QDomDocument document = QDomDocument();
int type = typeCombo->currentItem();
switch (type)
{
case 1:{
el.setAttribute("type","script");
item = document.createElement("script");
switch (inputBox->currentItem())
{
case 1:{ item.setAttribute("input", "current");
break;
}
case 2:{ item.setAttribute("input", "selected");
break;
}
default:{ item.setAttribute("input", "none");
break;
}
}
switch (outputBox->currentItem())
{
case 1:{ item.setAttribute("output", "cursor");
break;
}
case 2:{ item.setAttribute("output", "selection");
break;
}
case 3:{ item.setAttribute("output", "replace");
break;
}
case 4:{ item.setAttribute("output", "new");
break;
}
case 5:{ item.setAttribute("output", "message");
break;
}
default:{ item.setAttribute("output", "none");
break;
}
}
//.........这里部分代码省略.........
示例7: eWidget
//.........这里部分代码省略.........
}
if (cmd->id == CmdUrl){
if (m_bInProcess){
stop("");
return e->param();
}
QString jid;
QString node;
Command cmd;
cmd->id = CmdUrl;
cmd->param = this;
Event eWidget(EventCommandWidget, cmd);
CToolCombo *cmbUrl = (CToolCombo*)(eWidget.process());
if (cmbUrl)
jid = cmbUrl->lineEdit()->text();
cmd->id = CmdNode;
CToolCombo *cmbNode = (CToolCombo*)(eWidget.process());
if (cmbNode)
node = cmbNode->lineEdit()->text();
if (!jid.isEmpty()){
addHistory(jid);
goUrl(jid, node);
}
return e->param();
}
}
if (e->type() == EventDiscoItem){
if (!m_bInProcess)
return NULL;
DiscoItem *item = (DiscoItem*)(e->param());
QListViewItem *it = findItem(COL_ID_DISCO_ITEMS, item->id.c_str());
if (it){
if (item->jid.empty()){
it->setText(COL_ID_DISCO_ITEMS, "");
if (it != m_list->firstChild()){
checkDone();
adjustColumn(it);
return e->param();
}
QString err;
if (!item->name.empty()){
err = QString::fromUtf8(item->name.c_str());
}else if (!item->node.empty()){
err = i18n("Error %1") .arg(atol(item->node.c_str()));
}
if (!err.isEmpty()){
unsigned mode = atol(it->text(COL_MODE).latin1());
if (((mode & BROWSE_BROWSE) == 0) || (it->text(COL_ID_BROWSE).isEmpty() & m_bError))
stop(err);
m_bError = true;
}
checkDone();
adjustColumn(it);
return e->param();
}
if (it->firstChild() == NULL){
it->setExpandable(true);
if ((it == m_list->firstChild()) || (it == m_list->currentItem()))
it->setOpen(true);
}
QListViewItem *i;
for (i = it->firstChild(); i; i = i->nextSibling()){
if ((i->text(COL_JID) == QString::fromUtf8(item->jid.c_str())) &&
(i->text(COL_NODE) == QString::fromUtf8(item->node.c_str())))
return e->param();
}
示例8: slot_game
// take a new game from parser
void ClientWindow::slot_game(Game* g)
{
// insert into ListView
QListViewItemIterator lv(ListView_games);
if (g->running)
{
bool found = false;
GamesTableItem *lvi_mem = NULL;
// check if game already exists
if (!playerListEmpty)
{
QListViewItemIterator lvii = lv;
for (GamesTableItem *lvi; (lvi = static_cast<GamesTableItem*>(lvii.current())) && !found;)
{
lvii++;
// compare game id
if (lvi->text(0) == g->nr)
{
found = true;
lvi_mem = lvi;
}
}
}
else if (!g->H && !myAccount->num_games)
{
// skip games until initial table has loaded
qDebug("game skipped because no init table");
return;
}
QString excludeMark = "";
QString myMark = "B";
// check if exclude entry is done later
if (g->H) //g->status.length() > 1)
{
QString emw;
QString emb;
// no: do it now
emw = getPlayerExcludeListEntry(g->wname);
emb = getPlayerExcludeListEntry(g->bname);
// ensure that my game is listed first
if (emw && emw == "M" || emb && emb == "M")
{
myMark = "A";
excludeMark = "M";
// I'm playing, thus I'm open, except teaching games
if (emw && emw && (emw != "M" || emb != "M"))
{
// checkbox open
slot_checkbox(0, true);
}
}
else if (emw && emw == "W" || emb && emb == "W")
{
excludeMark = "W";
}
}
if (found)
{
// supersede entry
//lvi_mem->setText(0, g->nr);
lvi_mem->setText(1, g->wname);
lvi_mem->setText(2, g->wrank);
lvi_mem->setText(3, g->bname);
lvi_mem->setText(4, g->brank);
lvi_mem->setText(5, g->mv);
lvi_mem->setText(6, g->Sz);
lvi_mem->setText(7, g->H);
lvi_mem->setText(8, g->K);
lvi_mem->setText(9, g->By);
lvi_mem->setText(10, g->FR);
lvi_mem->setText(11, g->ob);
// lvi_mem->setText(6, g->status + " (" + g->ob + ")");
lvi_mem->setText(12, myMark + rkToKey(g->wrank) + g->wname.lower() + ":" + excludeMark);
lvi_mem->ownRepaint();
}
else
{
// from GAMES command or game info{...}
if (g->H)
{
lv = new GamesTableItem(ListView_games,
g->nr,
" " + g->wname,
g->wrank,
" " + g->bname,
g->brank,
g->mv,
g->Sz,
g->H,
//.........这里部分代码省略.........
示例9: okData
void EditSettings::okData()
{
QString sql;
RDSqlQuery *q;
RDSqlQuery *q1;
std::map<unsigned,QString> dups;
if(edit_duplicate_carts_box->isChecked()!=
edit_system->allowDuplicateCartTitles()) {
QLabel *msg=new QLabel(this);
QProgressDialog *pd=new QProgressDialog(this);
pd->setLabel(msg);
pd->setCancelButton(NULL);
pd->setMinimumDuration(2);
if(!edit_duplicate_carts_box->isChecked()) {
//
// Check for dups
//
msg->setText(tr("Checking the Library for duplicates."));
sql="select NUMBER,TITLE from CART order by NUMBER";
q=new RDSqlQuery(sql);
int count=0;
int step=0;
int step_size=q->size()/10;
pd->setProgress(0,10);
while(q->next()) {
sql=QString().sprintf("select NUMBER from CART \
where (TITLE=\"%s\")&&(NUMBER!=%u)",
(const char *)RDEscapeString(q->value(1).toString()),
q->value(0).toUInt());
q1=new RDSqlQuery(sql);
while(q1->next()) {
dups[q1->value(0).toUInt()]=q->value(1).toString();
}
delete q1;
count++;
if(count>=step_size) {
pd->setProgress(++step);
count=0;
qApp->processEvents();
}
}
delete q;
pd->reset();
if(dups.size()>0) {
QListViewItem *item;
y_pos=305;
setMinimumWidth(sizeHint().width());
setMaximumWidth(sizeHint().width());
setMinimumHeight(sizeHint().height());
setMaximumHeight(sizeHint().height());
edit_duplicate_carts_box->setChecked(true);
edit_duplicate_label->show();
edit_duplicate_list->show();
edit_save_button->show();
edit_duplicate_list->clear();
edit_ok_button->setGeometry(sizeHint().width()-180,
sizeHint().height()-60,
80,50);
edit_cancel_button->
setGeometry(sizeHint().width()-90,sizeHint().height()-60,80,50);
for(std::map<unsigned,QString>::const_iterator ci=dups.begin();
ci!=dups.end();ci++) {
item=new QListViewItem(edit_duplicate_list);
item->setText(0,QString().sprintf("%06u",ci->first));
item->setText(1,ci->second);
}
return;
}
//
// All ok -- make the change
//
sql="alter table CART drop index TITLE_IDX";
q=new RDSqlQuery(sql);
delete q;
sql="alter table CART modify column TITLE char(255) unique";
q=new RDSqlQuery(sql);
delete q;
edit_system->setAllowDuplicateCartTitles(false);
}
示例10: it
ActionConfig::ActionConfig(QWidget *parent, struct ActionUserData *data, ActionPlugin *plugin)
: ActionConfigBase(parent)
{
m_data = data;
m_plugin = plugin;
m_menu = NULL;
setButtonsPict(this);
lstEvent->addColumn(i18n("Event"));
lstEvent->addColumn(i18n("Program"));
lstEvent->setExpandingColumn(1);
connect(btnHelp, SIGNAL(clicked()), this, SLOT(help()));
QListViewItem *item = new QListViewItem(lstEvent, i18n("Contact online"));
item->setText(2, QString::number(CONTACT_ONLINE));
item->setPixmap(0, makePixmap("ICQ"));
if (data->OnLine.ptr)
item->setText(1, QString::fromUtf8(data->OnLine.ptr));
item = new QListViewItem(lstEvent, i18n("Status changed"));
item->setText(2, QString::number(CONTACT_STATUS));
item->setPixmap(0, makePixmap("ICQ"));
if (data->Status.ptr)
item->setText(1, QString::fromUtf8(data->Status.ptr));
CommandDef *cmd;
CommandsMapIterator it(m_plugin->core->messageTypes);
while ((cmd = ++it) != NULL){
MessageDef *def = (MessageDef*)(cmd->param);
if ((def == NULL) || (cmd->icon == NULL) ||
(def->flags & (MESSAGE_HIDDEN | MESSAGE_SENDONLY | MESSAGE_CHILD)))
continue;
if ((def->singular == NULL) || (def->plural == NULL) ||
(*def->singular == 0) || (*def->plural == 0))
continue;
QString type = i18n(def->singular, def->plural, 1);
int pos = type.find("1 ");
if (pos == 0){
type = type.mid(2);
}else if (pos > 0){
type = type.left(pos);
}
type = type.left(1).upper() + type.mid(1);
QListViewItem *item = new QListViewItem(lstEvent, type);
item->setText(2, QString::number(cmd->id));
item->setPixmap(0, makePixmap(cmd->icon));
item->setText(1, QString::fromUtf8(get_str(data->Message, cmd->id)));
}
m_edit = NULL;
m_editItem = NULL;
connect(lstEvent, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(selectionChanged(QListViewItem*)));
for (QObject *p = parent; p != NULL; p = p->parent()){
if (!p->inherits("QTabWidget"))
continue;
QTabWidget *tab = static_cast<QTabWidget*>(p);
m_menu = new MenuConfig(tab, data);
tab->addTab(m_menu, i18n("Menu"));
tab->adjustSize();
break;
}
lstEvent->adjustColumn();
setMinimumSize(sizeHint());
}
示例11: QLabel
ListGpis::ListGpis(RDMatrix *matrix,RDMatrix::GpioType type,
QWidget *parent,const char *name)
: QDialog(parent,name,true)
{
QString sql;
RDSqlQuery *q;
QListViewItem *l;
QString list_label;
list_matrix=matrix;
list_type=type;
switch(type) {
case RDMatrix::GpioInput:
list_tablename="GPIS";
list_size=list_matrix->gpis();
list_label=tr("GPI Lines");
setCaption(tr("List GPIs"));
break;
case RDMatrix::GpioOutput:
list_tablename="GPOS";
list_size=list_matrix->gpos();
list_label=tr("GPO Lines");
setCaption(tr("List GPOs"));
break;
}
//
// Fix the Window Size
//
setMinimumWidth(sizeHint().width());
setMinimumHeight(sizeHint().height());
//
// Create Fonts
//
QFont bold_font=QFont("Helvetica",12,QFont::Bold);
bold_font.setPixelSize(12);
QFont font=QFont("Helvetica",12,QFont::Normal);
font.setPixelSize(12);
//
// Gpis List Box
//
list_list_view=new QListView(this,"list_box");
list_list_label=
new QLabel(list_list_view,list_label,this,"list_view_label");
list_list_label->setFont(bold_font);
list_list_view->setAllColumnsShowFocus(true);
list_list_view->setItemMargin(5);
connect(list_list_view,
SIGNAL(doubleClicked(QListViewItem *,const QPoint &,int)),
this,
SLOT(doubleClickedData(QListViewItem *,const QPoint &,int)));
switch(list_type) {
case RDMatrix::GpioInput:
list_list_view->addColumn(tr("GPI"));
break;
case RDMatrix::GpioOutput:
list_list_view->addColumn(tr("GPO"));
break;
}
list_list_view->setColumnAlignment(0,Qt::AlignHCenter);
list_list_view->addColumn(tr("ON MACRO CART"));
list_list_view->setColumnAlignment(1,Qt::AlignHCenter);
list_list_view->addColumn(tr("ON DESCRIPTION"));
list_list_view->setColumnAlignment(2,Qt::AlignLeft);
list_list_view->addColumn(tr("OFF MACRO CART"));
list_list_view->setColumnAlignment(3,Qt::AlignHCenter);
list_list_view->addColumn(tr("OFF DESCRIPTION"));
list_list_view->setColumnAlignment(4,Qt::AlignLeft);
//
// Edit Button
//
list_edit_button=new QPushButton(this,"list_edit_button");
list_edit_button->setFont(bold_font);
list_edit_button->setText(tr("&Edit"));
connect(list_edit_button,SIGNAL(clicked()),this,SLOT(editData()));
//
// Ok Button
//
list_ok_button=new QPushButton(this,"list_ok_button");
list_ok_button->setDefault(true);
list_ok_button->setFont(bold_font);
list_ok_button->setText(tr("&OK"));
connect(list_ok_button,SIGNAL(clicked()),this,SLOT(okData()));
//
// Cancel Button
//
list_cancel_button=new QPushButton(this,"list_cancel_button");
list_cancel_button->setFont(bold_font);
//.........这里部分代码省略.........
示例12: itemsLineEditIt
EditFunctions::EditFunctions( QWidget *parent, FormWindow *fw, bool justSlots )
: EditFunctionsBase( parent, 0, TRUE ), formWindow( fw )
{
connect( helpButton, SIGNAL( clicked() ), MainWindow::self, SLOT( showDialogHelp() ) );
id = 0;
functList.clear();
QValueList<MetaDataBase::Function> functionList = MetaDataBase::functionList( fw );
for ( QValueList<MetaDataBase::Function>::Iterator it = functionList.begin(); it != functionList.end(); ++it ) {
QListViewItem *i = new QListViewItem( functionListView );
i->setPixmap( 0, QPixmap::fromMimeSource( "designer_editslots.png" ) );
i->setText( 0, (*it).function );
i->setText( 1, (*it).returnType );
i->setText( 2, (*it).specifier );
i->setText( 3, (*it).access );
i->setText( 4, (*it).type );
FunctItem fui;
fui.id = id;
fui.oldName = (*it).function;
fui.newName = fui.oldName;
fui.oldRetTyp = (*it).returnType;
fui.retTyp = fui.oldRetTyp;
fui.oldSpec = (*it).specifier;
fui.spec = fui.oldSpec;
fui.oldAccess = (*it).access;
fui.access = fui.oldAccess;
fui.oldType = (*it).type;
fui.type = fui.oldType;
functList.append( fui );
functionIds.insert( i, id );
id++;
if ( (*it).type == "slot" ) {
if ( MetaDataBase::isSlotUsed( formWindow, MetaDataBase::normalizeFunction( (*it).function ).latin1() ) )
i->setText( 5, tr( "Yes" ) );
else
i->setText( 5, tr( "No" ) );
} else {
i->setText( 5, "---" );
}
}
boxProperties->setEnabled( FALSE );
functionName->setValidator( new AsciiValidator( TRUE, functionName ) );
if ( functionListView->firstChild() )
functionListView->setCurrentItem( functionListView->firstChild() );
showOnlySlots->setChecked( justSlots );
lastType = "function";
// Enable rename for all QListViewItems
QListViewItemIterator lvit = functionListView->firstChild();
for ( ; *lvit; lvit++ )
(*lvit)->setRenameEnabled( 0, TRUE );
// Connect listview signal to signal-relay
QObject::connect( functionListView,
SIGNAL( itemRenamed( QListViewItem*, int, const QString & ) ),
this,
SLOT( emitItemRenamed(QListViewItem*, int, const QString&) ) );
// Connect signal-relay to QLineEdit "functionName"
QObjectList *l = parent->queryList( "QLineEdit", "functionName" );
QObject *obj;
QObjectListIt itemsLineEditIt( *l );
while ( (obj = itemsLineEditIt.current()) != 0 ) {
++itemsLineEditIt;
QObject::connect( this,
SIGNAL( itemRenamed( const QString & ) ),
obj,
SLOT( setText( const QString & ) ) );
}
delete l;
}
示例13: updateServerOnlineList
/**
* Refresh the nicklistview for a single server.
* @param server The server to be refreshed.
*/
void NicksOnline::updateServerOnlineList(Server* servr)
{
bool newNetworkRoot = false;
QString serverName = servr->getServerName();
QString networkName = servr->getDisplayName();
QListViewItem* networkRoot = findNetworkRoot(networkName);
// If network is not in our list, add it.
if (!networkRoot)
{
networkRoot = new NicksOnlineItem(NicksOnlineItem::NetworkRootItem,m_nickListView,networkName);
newNetworkRoot = true;
}
// Store server name in hidden column.
// Note that there could be more than one server in the network connected,
// but it doesn't matter because all the servers in a network have the same
// watch list.
networkRoot->setText(nlvcServerName, serverName);
// Update list of servers in the network that are connected.
QStringList serverList = QStringList::split(",", networkRoot->text(nlvcAdditionalInfo));
if (!serverList.contains(serverName)) serverList.append(serverName);
networkRoot->setText(nlvcAdditionalInfo, serverList.join(","));
// Get item in nicklistview for the Offline branch.
QListViewItem* offlineRoot = findItemType(networkRoot, NicksOnlineItem::OfflineItem);
if (!offlineRoot)
{
offlineRoot = new NicksOnlineItem(NicksOnlineItem::OfflineItem,networkRoot,i18n("Offline"));
offlineRoot->setText(nlvcServerName, serverName);
}
// Get watch list.
QStringList watchList = servr->getWatchList();
QStringList::iterator itEnd = watchList.end();
QString nickname;
for (QStringList::iterator it = watchList.begin(); it != itEnd; ++it)
{
nickname = (*it);
NickInfoPtr nickInfo = getOnlineNickInfo(networkName, nickname);
if (nickInfo && nickInfo->getPrintedOnline())
{
// Nick is online.
// Which server did NickInfo come from?
Server* server=nickInfo->getServer();
// Get addressbook entry (if any) for the nick.
KABC::Addressee addressee = nickInfo->getAddressee();
// Construct additional information string for nick.
bool needWhois = false;
QString nickAdditionalInfo = getNickAdditionalInfo(nickInfo, addressee, needWhois);
// Remove from offline branch if present.
QListViewItem* item = findItemChild(offlineRoot, nickname, NicksOnlineItem::NicknameItem);
if (item) delete item;
// Add to network if not already added.
QListViewItem* nickRoot = findItemChild(networkRoot, nickname, NicksOnlineItem::NicknameItem);
if (!nickRoot) nickRoot = new NicksOnlineItem(NicksOnlineItem::NicknameItem,networkRoot, nickname, nickAdditionalInfo);
nickRoot->setText(nlvcAdditionalInfo, nickAdditionalInfo);
nickRoot->setText(nlvcServerName, serverName);
// If no additional info available, request a WHOIS on the nick.
if (!m_whoisRequested)
{
if (needWhois)
{
requestWhois(networkName, nickname);
m_whoisRequested = true;
}
}
// Set Kabc icon if the nick is associated with an addressbook entry.
if (!addressee.isEmpty())
nickRoot->setPixmap(nlvcKabc, m_kabcIconSet.pixmap(
QIconSet::Small, QIconSet::Normal, QIconSet::On));
else
nickRoot->setPixmap(nlvcKabc, m_kabcIconSet.pixmap(
QIconSet::Small, QIconSet::Disabled, QIconSet::Off));
QStringList channelList = server->getNickChannels(nickname);
QStringList::iterator itEnd2 = channelList.end();
for (QStringList::iterator it2 = channelList.begin(); it2 != itEnd2; ++it2)
{
// Known channels where nickname is online and mode in each channel.
// FIXME: If user connects to multiple servers in same network, the
// channel info will differ between the servers, resulting in inaccurate
// mode and led info displayed.
QString channelName = (*it2);
ChannelNickPtr channelNick = server->getChannelNick(channelName, nickname);
QString nickMode;
if (channelNick->hasVoice()) nickMode = nickMode + i18n(" Voice");
if (channelNick->isHalfOp()) nickMode = nickMode + i18n(" HalfOp");
if (channelNick->isOp()) nickMode = nickMode + i18n(" Operator");
if (channelNick->isOwner()) nickMode = nickMode + i18n(" Owner");
if (channelNick->isAdmin()) nickMode = nickMode + i18n(" Admin");
QListViewItem* channelItem = findItemChild(nickRoot, channelName, NicksOnlineItem::ChannelItem);
if (!channelItem) channelItem = new NicksOnlineItem(NicksOnlineItem::ChannelItem,nickRoot,
channelName, nickMode);
//.........这里部分代码省略.........
示例14: recvIO_SearchReply
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();
}
示例15: initUI
void LayoutConfig::initUI()
{
const char *modelName = m_rules->models()[m_kxkbConfig.m_model];
if(modelName == NULL)
modelName = DEFAULT_MODEL;
widget->comboModel->setCurrentText(i18n(modelName));
QValueList< LayoutUnit > otherLayouts = m_kxkbConfig.m_layouts;
widget->listLayoutsDst->clear();
// to optimize we should have gone from it.end to it.begin
QValueList< LayoutUnit >::ConstIterator it;
for(it = otherLayouts.begin(); it != otherLayouts.end(); ++it)
{
QListViewItemIterator src_it(widget->listLayoutsSrc);
LayoutUnit layoutUnit = *it;
for(; src_it.current(); ++src_it)
{
QListViewItem *srcItem = src_it.current();
if(layoutUnit.layout == src_it.current()->text(LAYOUT_COLUMN_MAP))
{ // check if current config knows about this layout
QListViewItem *newItem = copyLVI(srcItem, widget->listLayoutsDst);
newItem->setText(LAYOUT_COLUMN_VARIANT, layoutUnit.variant);
newItem->setText(LAYOUT_COLUMN_INCLUDE, layoutUnit.includeGroup);
newItem->setText(LAYOUT_COLUMN_DISPLAY_NAME, layoutUnit.displayName);
widget->listLayoutsDst->insertItem(newItem);
newItem->moveItem(widget->listLayoutsDst->lastItem());
break;
}
}
}
// display KXKB switching options
widget->chkShowSingle->setChecked(m_kxkbConfig.m_showSingle);
widget->chkShowFlag->setChecked(m_kxkbConfig.m_showFlag);
widget->chkEnableOptions->setChecked(m_kxkbConfig.m_enableXkbOptions);
widget->checkResetOld->setChecked(m_kxkbConfig.m_resetOldOptions);
switch(m_kxkbConfig.m_switchingPolicy)
{
default:
case SWITCH_POLICY_GLOBAL:
widget->grpSwitching->setButton(0);
break;
case SWITCH_POLICY_WIN_CLASS:
widget->grpSwitching->setButton(1);
break;
case SWITCH_POLICY_WINDOW:
widget->grpSwitching->setButton(2);
break;
}
widget->chkEnableSticky->setChecked(m_kxkbConfig.m_stickySwitching);
widget->spinStickyDepth->setEnabled(m_kxkbConfig.m_stickySwitching);
widget->spinStickyDepth->setValue(m_kxkbConfig.m_stickySwitchingDepth);
updateStickyLimit();
widget->chkEnable->setChecked(m_kxkbConfig.m_useKxkb);
widget->grpLayouts->setEnabled(m_kxkbConfig.m_useKxkb);
widget->optionsFrame->setEnabled(m_kxkbConfig.m_useKxkb);
// display xkb options
QStringList options = QStringList::split(',', m_kxkbConfig.m_options);
for(QStringList::ConstIterator it = options.begin(); it != options.end(); ++it)
{
QString option = *it;
QString optionKey = option.mid(0, option.find(':'));
QString optionName = m_rules->options()[option];
OptionListItem *item = m_optionGroups[i18n(optionKey.latin1())];
if(item != NULL)
{
OptionListItem *child = item->findChildItem(option);
if(child)
child->setState(QCheckListItem::On);
else
kdDebug() << "load: Unknown option: " << option << endl;
}
else
{
kdDebug() << "load: Unknown option group: " << optionKey << " of " << option << endl;
}
}
updateOptionsCommand();
emit KCModule::changed(false);
}