class ContactView : public QListView, public QToolTip{ Q_OBJECTpublic: ContactView(QWidget *parent=0, const char *name=0); ~ContactView();
class ContactView : public Q3ListView{ Q_OBJECTpublic: ContactView(QWidget *parent=0, const char *name=0); ~ContactView();
void ContactViewItem::paintFocus(QPainter *, const QColorGroup &, const QRect &){ // re-implimented to do nothing. selection is enough of a focus}/*void ContactViewItem::paintBranches(QPainter *p, const QColorGroup &cg, int w, int, int h){ // paint a square of nothing p->fillRect(0, 0, w, h, cg.base());}*/void ContactViewItem::paintCell(QPainter *p, const QColorGroup & cg, int column, int width, int alignment){ if ( d->type == Contact ) { QColorGroup xcg = cg; if(d->status == STATUS_AWAY || d->status == STATUS_XA) xcg.setColor(QColorGroup::Text, option.color[cAway]); else if(d->status == STATUS_DND) xcg.setColor(QColorGroup::Text, option.color[cDND]); else if(d->status == STATUS_OFFLINE) xcg.setColor(QColorGroup::Text, option.color[cOffline]); if(d->animatingNick) { xcg.setColor(QColorGroup::Text, d->animateNickColor ? option.color[cAnimFront] : option.color[cAnimBack]); xcg.setColor(QColorGroup::HighlightedText, d->animateNickColor ? option.color[cAnimFront] : option.color[cAnimBack]); } QListViewItem::paintCell(p, xcg, column, width, alignment); QFontMetrics fm(p->font()); const QPixmap *pix = pixmap(column); int x = fm.width(text(column)) + (pix ? pix->width() : 0) + 8; if ( d->u ) { UserResourceList::ConstIterator it = d->u->priority(); if(it != d->u->userResourceList().end()) { if(d->u->isSecure((*it).name())) { const QPixmap &pix = IconsetFactory::iconPixmap("psi/cryptoYes"); int y = (height() - pix.height()) / 2; p->drawPixmap(x, y, pix); x += 24; } } } } else if ( d->type == Group || d->type == Profile ) { QColorGroup xcg = cg; xcg.setColor(QColorGroup::Text, option.color[cGroupFore]); if(d->type == Group && option.clNewHeadings) { //xcg.setColor(QColorGroup::Text, option.color[cGroupBack]); QFont f = p->font(); f.setPointSize(option.smallFontSize); p->setFont(f); } else { //xcg.setColor(QColorGroup::Text, option.color[cGroupFore]); //xcg.setColor(QColorGroup::Base, option.color[cGroupBack]); } QListViewItem::paintCell(p, xcg, column, width, alignment); QFontMetrics fm(p->font()); const QPixmap *pix = pixmap(column); int x = fm.width(text(column)) + (pix ? pix->width() : 0) + 8; if(d->type == Profile) { const QPixmap &pix = d->ssl ? IconsetFactory::iconPixmap("psi/cryptoYes") : IconsetFactory::iconPixmap("psi/cryptoNo"); int y = (height() - pix.height()) / 2; p->drawPixmap(x, y, pix); x += 24; } if(isSelected()) p->setPen(xcg.highlightedText()); else p->setPen(xcg.text()); int y = ((height() - fm.height()) / 2) + fm.ascent(); p->drawText(x, y, d->groupInfo); if(d->type == Group && option.clNewHeadings && !isSelected()) { x += fm.width(d->groupInfo) + 8; if(x < width - 8) { int h = (height() / 2) - 1; p->setPen(QPen(option.color[cGroupBack])); p->drawLine(x, h, width - 8, h); h++; p->setPen(QPen(option.color[cGroupFore])); /*int h = height() / 2; p->setPen(QPen(option.color[cGroupBack], 2));*/ p->drawLine(x, h, width - 8, h); } } else { p->setPen(QPen(option.color[cGroupFore])); //p->drawRect(0, 0, width, height()); } }}
void ContactViewItem::paintFocus(QPainter *, const QColorGroup &, const QRect &){ // re-implimented to do nothing. selection is enough of a focus}void ContactViewItem::paintBranches(QPainter *p, const QColorGroup &cg, int w, int, int h){ // paint a square of nothing p->fillRect(0, 0, w, h, cg.base());}void ContactViewItem::paintCell(QPainter *p, const QColorGroup & cg, int column, int width, int alignment){ if ( type_ == Contact ) { QColorGroup xcg = cg; if(d->status == STATUS_AWAY || d->status == STATUS_XA) xcg.setColor(QColorGroup::Text, PsiOptions::instance()->getOption("options.ui.look.colors.contactlist.status.away").value<QColor>()); else if(d->status == STATUS_DND) xcg.setColor(QColorGroup::Text, PsiOptions::instance()->getOption("options.ui.look.colors.contactlist.status.do-not-disturb").value<QColor>()); else if(d->status == STATUS_OFFLINE) xcg.setColor(QColorGroup::Text, PsiOptions::instance()->getOption("options.ui.look.colors.contactlist.status.offline").value<QColor>()); if(d->animatingNick) { xcg.setColor(QColorGroup::Text, d->animateNickColor ? PsiOptions::instance()->getOption("options.ui.look.contactlist.status-change-animation.color1").value<QColor>() : PsiOptions::instance()->getOption("options.ui.look.contactlist.status-change-animation.color2").value<QColor>()); xcg.setColor(QColorGroup::HighlightedText, d->animateNickColor ? PsiOptions::instance()->getOption("options.ui.look.contactlist.status-change-animation.color1").value<QColor>() : PsiOptions::instance()->getOption("options.ui.look.contactlist.status-change-animation.color2").value<QColor>()); } RichListViewItem::paintCell(p, xcg, column, width, alignment); int x; if (d->status_single) x = widthUsed(); else { QFontMetrics fm(p->font()); const QPixmap *pix = pixmap(column); x = fm.width(text(column)) + (pix ? pix->width() : 0) + 8; } if ( d->u ) { UserResourceList::ConstIterator it = d->u->priority(); if(it != d->u->userResourceList().end()) { if(d->u->isSecure((*it).name())) { const QPixmap &pix = IconsetFactory::iconPixmap("psi/cryptoYes"); int y = (height() - pix.height()) / 2; p->drawPixmap(x, y, pix); x += 24; } } } } else if ( type_ == Group || type_ == Profile ) { QColorGroup xcg = cg; if(type_ == Profile) { xcg.setColor(QColorGroup::Text, PsiOptions::instance()->getOption("options.ui.look.colors.contactlist.profile.header-foreground").value<QColor>()); #if QT_VERSION < 0x040301 xcg.setColor(QColorGroup::Background, PsiOptions::instance()->getOption("options.ui.look.colors.contactlist.profile.header-background").value<QColor>()); #else xcg.setColor(QColorGroup::Base, PsiOptions::instance()->getOption("options.ui.look.colors.contactlist.profile.header-background").value<QColor>()); #endif } else if(type_ == Group) { QFont f = p->font(); f.setPointSize(common_smallFontSize); p->setFont(f); xcg.setColor(QColorGroup::Text, PsiOptions::instance()->getOption("options.ui.look.colors.contactlist.grouping.header-foreground").value<QColor>()); if (!PsiOptions::instance()->getOption("options.ui.look.contactlist.use-slim-group-headings").toBool()) { #if QT_VERSION < 0x040301 xcg.setColor(QColorGroup::Background, PsiOptions::instance()->getOption("options.ui.look.colors.contactlist.grouping.header-background").value<QColor>()); #else xcg.setColor(QColorGroup::Base, PsiOptions::instance()->getOption("options.ui.look.colors.contactlist.grouping.header-background").value<QColor>()); #endif } } Q3ListViewItem::paintCell(p, xcg, column, width, alignment); QFontMetrics fm(p->font()); const QPixmap *pix = pixmap(column); int x = fm.width(text(column)) + (pix ? pix->width() : 0) + 8; if(type_ == Profile) { const QPixmap &pix = d->ssl ? IconsetFactory::iconPixmap("psi/cryptoYes") : IconsetFactory::iconPixmap("psi/cryptoNo"); int y = (height() - pix.height()) / 2; p->drawPixmap(x, y, pix); x += 24; } if(isSelected()) p->setPen(xcg.highlightedText()); else p->setPen(xcg.text()); QFont f_info = p->font(); f_info.setPointSize(common_smallFontSize); p->setFont(f_info); QFontMetrics fm_info(p->font()); //int info_x = width - fm_info.width(d->groupInfo) - 8; int info_x = x; int info_y = ((height() - fm_info.height()) / 2) + fm_info.ascent(); p->drawText((info_x > x ? info_x : x), info_y, d->groupInfo); if(type_ == Group && PsiOptions::instance()->getOption("options.ui.look.contactlist.use-slim-group-headings").toBool() && !isSelected()) { x += fm.width(d->groupInfo) + 8; if(x < width - 8) { int h = (height() / 2) - 1; p->setPen(QPen(PsiOptions::instance()->getOption("options.ui.look.colors.contactlist.grouping.header-background").value<QColor>())); p->drawLine(x, h, width - 8, h); h++; p->setPen(QPen(PsiOptions::instance()->getOption("options.ui.look.colors.contactlist.grouping.header-foreground").value<QColor>())); /*int h = height() / 2; p->setPen(QPen(PsiOptions::instance()->getOption("options.ui.look.colors.contactlist.grouping.header-background").value<QColor>(), 2));*/ p->drawLine(x, h, width - 8, h); } } else { if (PsiOptions::instance()->getOption("options.ui.look.contactlist.use-outlined-group-headings").toBool()) { p->setPen(QPen(PsiOptions::instance()->getOption("options.ui.look.colors.contactlist.grouping.header-foreground").value<QColor>())); p->drawRect(0, 0, width, height()); } } }}