UserConfig::UserConfig(Contact *contact, Group *group) : ConfigureDialogBase(NULL, "userconfig", false, WDestructiveClose) { m_contact = contact; m_group = group; m_nUpdates = 0; SET_WNDPROC("configure") setIcon(Pict(contact ? "info" : "configure")); setButtonsPict(this); setTitle(); QIconSet iconSet = Icon("webpress"); if (!iconSet.pixmap(QIconSet::Small, QIconSet::Normal).isNull()) btnUpdate->setIconSet(iconSet); btnUpdate->hide(); lstBox->setHScrollBarMode(QScrollView::AlwaysOff); lstBox->setSorting(1); lstBox->header()->hide(); fill(); connect(lstBox, SIGNAL(currentChanged(QListViewItem*)), this, SLOT(itemSelected(QListViewItem*))); connect(buttonApply, SIGNAL(clicked()), this, SLOT(apply())); connect(btnUpdate, SIGNAL(clicked()), this, SLOT(updateInfo())); lstBox->setCurrentItem(lstBox->firstChild()); itemSelected(lstBox->firstChild()); }
void JabberAdd::setBrowser(bool bBrowser) { if (m_bBrowser == bBrowser) return; m_bBrowser = bBrowser; if (m_bBrowser && (m_browser == NULL)){ m_browser = new JabberBrowser; emit addResult(m_browser); m_browser->setClient(m_client); connect(m_browser, SIGNAL(destroyed()), this, SLOT(browserDestroyed())); } emit showResult(m_bBrowser ? m_browser : NULL); QIconSet is = Icon(m_bBrowser ? "1leftarrow" : "1rightarrow"); if (!is.pixmap(QIconSet::Small, QIconSet::Normal).isNull()) btnBrowser->setIconSet(is); if (m_bBrowser){ edtJID->setEnabled(false); edtMail->setEnabled(false); edtFirst->setEnabled(false); edtLast->setEnabled(false); edtNick->setEnabled(false); lblFirst->setEnabled(false); lblLast->setEnabled(false); lblNick->setEnabled(false); emit setAdd(false); }else{ grpJID->slotToggled(); grpName->slotToggled(); grpMail->slotToggled(); } }
void WharfIcon::set(const char *icon, const char *msg) { QIconSet icons = Icon(icon); QPixmap *nvis = new QPixmap(icons.pixmap(QIconSet::Large, QIconSet::Normal)); if (bActivated){ resize(nvis->width(), nvis->height()); move((p_width - nvis->width()) / 2, (p_height - nvis->height()) / 2); } if (msg){ QPixmap msgPict = Pict(msg); QRegion *rgn = NULL; if (nvis->mask() && msgPict.mask()){ rgn = new QRegion(*msgPict.mask()); rgn->translate(nvis->width() - msgPict.width() - SMALL_PICT_OFFS, nvis->height() - msgPict.height() - SMALL_PICT_OFFS); *rgn += *nvis->mask(); } QPainter p; p.begin(nvis); p.drawPixmap(nvis->width() - msgPict.width() - SMALL_PICT_OFFS, nvis->height() - msgPict.height() - SMALL_PICT_OFFS, msgPict); p.end(); if (rgn){ setMask(*rgn); delete rgn; } }else{ const QBitmap *mask = nvis->mask(); if (mask) setMask(*mask); } if (vis) delete vis; vis = nvis; setIcon(*vis); repaint(); }
void WidgetDatabase::setupPlugins() { if ( plugins_set_up ) return; plugins_set_up = TRUE; QStringList widgets = widgetManager()->featureList(); for ( QStringList::Iterator it = widgets.begin(); it != widgets.end(); ++it ) { if ( hasWidget( *it ) ) continue; WidgetDatabaseRecord *r = new WidgetDatabaseRecord; WidgetInterface *iface = 0; widgetManager()->queryInterface( *it, &iface ); if ( !iface ) continue; #ifndef UIC QIconSet icon = iface->iconSet( *it ); if ( !icon.pixmap().isNull() ) r->icon = new QIconSet( icon ); #endif QString grp = iface->group( *it ); if ( grp.isEmpty() ) grp = "3rd party widgets"; r->group = widgetGroup( grp ); r->toolTip = iface->toolTip( *it ); r->whatsThis = iface->whatsThis( *it ); r->includeFile = iface->includeFile( *it ); r->isContainer = iface->isContainer( *it ); r->name = *it; r->isPlugin = TRUE; append( r ); iface->release(); } }
QPixmap Addressbook::icon(const QString &uid) { Images* icons = KonversationApplication::instance()->images(); QIconSet currentIcon; if(!isPresent(uid)) return QPixmap(); switch(presenceStatus(uid)) { case 0: //Unknown case 1: //Offline case 2: //connecting - invalid for us? currentIcon = icons->getKimproxyOffline(); break; case 3: //Away currentIcon = icons->getKimproxyAway(); break; case 4: //Online currentIcon = icons->getKimproxyOnline(); break; default: //error kdDebug() << "Unknown status " << uid << endl; return QPixmap(); } QPixmap joinedIcon = currentIcon.pixmap(QIconSet::Automatic, QIconSet::Active, QIconSet::On); return joinedIcon; }
QSize QToolBoxButton::sizeHint() const { QSize iconSize(8, 8); if ( !icon.isNull() ) iconSize += icon.pixmap( QIconSet::Small, QIconSet::Normal ).size() + QSize( 2, 0 ); QSize textSize = fontMetrics().size( Qt::ShowPrefix, label ) + QSize(0, 8); QSize total(iconSize.width() + textSize.width(), QMAX(iconSize.height(), textSize.height())); return total.expandedTo(QApplication::globalStrut()); }
void propertySetter::addButton(){ m_pb = new KPushButton(this); QToolTip::add(m_pb, i18n( "More..." )); QIconSet iconSet = SmallIconSet(QString::fromLatin1("2rightarrow")); QPixmap pixMap = iconSet.pixmap( QIconSet::Small, QIconSet::Normal ); m_pb->setIconSet(iconSet); m_pb->setFixedSize( pixMap.width()+8, pixMap.height()+8 ); m_pb->hide(); connect(m_pb, SIGNAL(clicked()), this ,SLOT(Show())); }
void SourceDirTreeNode::refreshIcon() { if (Settings::sourceDirTreeShowIcons()) { QIconSet iconSet = KGlobal::iconLoader()->loadIconSet(Constants::ICON_SOURCEDIR, KIcon::Small, Settings::sourceDirTreeIconSize(), true); if (iconSet.isNull()) { tracer->swarning(__func__) << "Could not load iconset with iconname: '" << Constants::ICON_SOURCEDIR << "'" << endl; this->setPixmap(SourceDirTree::COLUMN_TEXT, 0); } else { this->setPixmap(SourceDirTree::COLUMN_TEXT, iconSet.pixmap()); } } else { this->setPixmap(SourceDirTree::COLUMN_TEXT, 0); } }
WharfIcon::WharfIcon(DockWnd *parent) : QWidget(parent, "WharfIcon") { dock = parent; setMouseTracking(true); QIconSet icon = Icon("inactive"); const QPixmap &pict = icon.pixmap(QIconSet::Large, QIconSet::Normal); setIcon(pict); resize(pict.width(), pict.height()); parentWin = 0; setBackgroundMode(X11ParentRelative); vis = NULL; bActivated = false; }
JabberAdd::JabberAdd(JabberClient *client, QWidget *parent) : JabberAddBase(parent) { m_client = client; m_browser = NULL; m_bBrowser = false; connect(this, SIGNAL(setAdd(bool)), topLevelWidget(), SLOT(setAdd(bool))); connect(this, SIGNAL(addResult(QWidget*)), topLevelWidget(), SLOT(addResult(QWidget*))); connect(this, SIGNAL(showResult(QWidget*)), topLevelWidget(), SLOT(showResult(QWidget*))); connect(grpJID, SIGNAL(toggled(bool)), this, SLOT(radioToggled(bool))); connect(grpMail, SIGNAL(toggled(bool)), this, SLOT(radioToggled(bool))); connect(grpName, SIGNAL(toggled(bool)), this, SLOT(radioToggled(bool))); connect(btnBrowser, SIGNAL(clicked()), this, SLOT(browserClick())); QIconSet is = Icon("1rightarrow"); if (!is.pixmap(QIconSet::Small, QIconSet::Normal).isNull()) btnBrowser->setIconSet(is); }
void SearchDialog::setAddButton() { QString text; QIconSet icon; if (m_active){ icon = Icon("cancel"); text = i18n("&Cancel"); }else if (m_bAdd){ icon = Icon("add"); text = i18n("&Add"); }else{ icon = Icon("find"); text = i18n("&Search"); } m_search->btnSearch->setText(text); if (!icon.pixmap(QIconSet::Small, QIconSet::Normal).isNull()) m_search->btnSearch->setIconSet(icon); }
//PRIVATE void KNewProjectDlg::initGUI() { QIconSet iconSet = SmallIconSet("fileopen"); QPixmap pixMap = iconSet.pixmap( QIconSet::Small, QIconSet::Normal ); m_pbLocation->setIconSet(iconSet); m_pbLocation->setFixedSize(pixMap.width() + 8, pixMap.height() + 8); m_pbSearchNow->setEnabled(false); loadOptions(); loadFileSizeOptions(); loadDateAccessOptions(); loadOwnerOptions(); loadBackupExtensionOptions(); loadLocationsList(); loadFiltersList(); }
ConfigureDialog::ConfigureDialog() { m_nUpdates = 0; SET_WNDPROC("configure") setIcon(Pict("configure")); setButtonsPict(this); setTitle(); lstBox->header()->hide(); QIconSet iconSet = Icon("webpress"); if (!iconSet.pixmap(QIconSet::Small, QIconSet::Normal).isNull()) btnUpdate->setIconSet(iconSet); btnUpdate->hide(); lstBox->setHScrollBarMode(QScrollView::AlwaysOff); fill(0); connect(buttonApply, SIGNAL(clicked()), this, SLOT(apply())); connect(btnUpdate, SIGNAL(clicked()), this, SLOT(updateInfo())); connect(lstBox, SIGNAL(currentChanged(QListViewItem*)), this, SLOT(itemSelected(QListViewItem*))); lstBox->setCurrentItem(lstBox->firstChild()); itemSelected(lstBox->firstChild()); }
QSize QToolBoxButton::minimumSizeHint() const { if ( icon.isNull() ) return QSize(); return QSize(8, 8) + icon.pixmap( QIconSet::Small, QIconSet::Normal ).size(); }
const QIconSet *Icons::getIcon(const char *name) { if (name == NULL) return NULL; PIXMAP_MAP::iterator it = icons.find(name); if (it == icons.end()){ string n = name; if (n == "online"){ unsigned i; const QIconSet *icon = NULL; const char *icon_name = NULL; for (i = 0; i < getContacts()->nClients(); i++){ Client *client = getContacts()->getClient(i); icon_name = client->protocol()->description()->icon; icon = Icon(icon_name); if (icon) break; } if (icon == NULL){ icon_name = "ICQ"; icon = Icon(icon_name); } if (icon == NULL) return NULL; unsigned flags = 0; it = icons.find(icon_name); if (it != icons.end()) flags = (*it).second.flags; PictDef *d = addIcon(name, NULL, NULL, flags); d->iconSet = *icon; return icon; } if (n == "offline"){ const QIconSet *icon = Icon("online"); if (icon == NULL) return NULL; unsigned flags = 0; it = icons.find("online"); if (it != icons.end()) flags = (*it).second.flags; QIconSet offline = makeOffline(flags, icon); PictDef *d = addIcon(name, NULL, NULL, flags); d->iconSet = offline; return &d->iconSet; } if (n == "inactive"){ const QIconSet *icon = Icon("online"); if (icon == NULL) return NULL; unsigned flags = 0; it = icons.find("online"); if (it != icons.end()) flags = (*it).second.flags; QIconSet offline = makeInactive(icon); PictDef *d = addIcon(name, NULL, NULL, flags); d->iconSet = offline; return &d->iconSet; } if (n == "invisible"){ const QIconSet *icon = Icon("online"); if (icon == NULL) return NULL; unsigned flags = 0; it = icons.find("online"); if (it != icons.end()) flags = (*it).second.flags; QIconSet invisible = makeInvisible(flags, icon); PictDef *d = addIcon(name, NULL, NULL, flags); d->iconSet = invisible; return &d->iconSet; } int pos = n.find('_'); if (pos > 0){ const QIconSet *icon = Icon(n.substr(0, pos).c_str()); unsigned flags = 0; it = icons.find(n.substr(0, pos).c_str()); if (it != icons.end()) flags = (*it).second.flags; QIconSet res; if (icon){ string s = n.substr(pos + 1); if (s == "online"){ res = *icon; }else if (s == "offline"){ res = makeOffline(flags, icon); }else if (s == "invisible"){ res = makeInvisible(flags, icon); }else{ const QIconSet *i = Icon(s.c_str()); if (i){ res = mergeIcon(icon, i->pixmap(QIconSet::Small, QIconSet::Normal)); }else{ it = icons.find(s.c_str()); if (it != icons.end()){ flags = (*it).second.flags; res = makeOffline(flags, icon); } } } } if (res.pixmap(QIconSet::Small, QIconSet::Normal).width()){ PictDef *d = addIcon(name, NULL, NULL, flags); d->iconSet = res; return &d->iconSet; } } log(L_DEBUG, "Icon %s not found", name); return NULL; } PictDef &p = (*it).second; if (p.iconSet.pixmap(QIconSet::Small, QIconSet::Normal).width()) return &p.iconSet; #ifdef USE_KDE if (p.system){ KIconLoader iconLoader; QPixmap pict = iconLoader.loadIcon(name, KIcon::Small, -22, KIcon::DefaultState, NULL, true); if (!pict.isNull()){ QPixmap pict1 = iconLoader.loadIcon(name, KIcon::Desktop, -64, KIcon::DefaultState, NULL, true); if (pict.isNull()){ p.iconSet = QIconSet(pict); }else{ p.iconSet = QIconSet(pict, pict1); } return &p.iconSet; } } #endif QPixmap pict = loadPict(name); if (!pict.isNull()){ if (pict.width() > 16){ QImage img = pict.convertToImage(); img = img.smoothScale(16, 16); QPixmap pict1(16, 16); pict1.convertFromImage(img); p.iconSet = QIconSet(pict1, pict); }else{ p.iconSet = QIconSet(pict); } return &p.iconSet; } if (p.xpm){ p.iconSet = QIconSet(QPixmap(p.xpm)); return &p.iconSet; } log(L_DEBUG, "Icon %s is empty", name); return NULL; }
KAboutApplication::KAboutApplication( const KAboutData *aboutData, QWidget *parent, const char *name, bool modal) : AboutDlgBase(parent, name, modal) { SET_WNDPROC("about") setButtonsPict(this); setCaption(caption()); connect(btnOK, SIGNAL(clicked()), this, SLOT(close())); setIcon(Pict("ICQ")); QIconSet icon = Icon("ICQ"); if (!icon.pixmap(QIconSet::Small, QIconSet::Normal).isNull()) lblIcon->setPixmap(icon.pixmap(QIconSet::Large, QIconSet::Normal)); edtVersion->setText(i18n("%1 Version: %2") .arg(aboutData->appName()) .arg(aboutData->version())); edtVersion->setReadOnly(true); QPalette p = palette(); p.setColor(QColorGroup::Base, colorGroup().background()); edtVersion->setPalette(p); txtAbout->setText((QString("<center><br>%1<br><br>%2<br><br>") + "<a href=\"%3\">%4</a><br><br>" + i18n("Bug report") + ": <a href=\"mailto:%5\">%6</a><br>" + i18n("Note: This is english mailing list") + "</center>") .arg(quote(aboutData->shortDescription())) .arg(quote(aboutData->copyrightStatement())) .arg(quote(aboutData->homepage())) .arg(quote(aboutData->homepage())) .arg(quote(aboutData->bugAddress())) .arg(quote(aboutData->bugAddress()))); QString txt; QValueList<KAboutPerson>::ConstIterator it; for (it = aboutData->authors().begin(); it != aboutData->authors().end(); ++it) { txt += addPerson(&(*it)); txt += "<br>"; } txtAuthors->setText(txt); txt = ""; QValueList<KAboutTranslator> translators = aboutData->translators(); QValueList<KAboutTranslator>::ConstIterator itt; if (!translators.isEmpty()){ for (itt = translators.begin(); itt != translators.end(); ++itt) { const KAboutTranslator &t = *itt; txt += QString("%1 <<a href=\"mailto:%2\">%3</a>><br>") .arg(quote(t.name())) .arg(quote(t.emailAddress())) .arg(quote(t.emailAddress())); txt += "<br>"; } txtTranslations->setText(txt); }else{ tabMain->removePage(tabTranslation); } QString license = aboutData->license(); license += "\n\n"; QFile f(QFile::decodeName(app_file("COPYING").c_str())); if (f.open(IO_ReadOnly)){ for (;;){ QString s; if (f.readLine(s, 512) == -1) break; license += s; } } txtLicence->setText(quote(license)); }
void TLPEditor::setButtonIcon(QString s){ QIconSet iconSet = SmallIconSet(QString::fromLatin1(s)); QPixmap pixMap = iconSet.pixmap( QIconSet::Small, QIconSet::Normal ); m_pb->setIconSet(iconSet); m_pb->setFixedSize( pixMap.width()+8, pixMap.height()+8 ); }
void QToolBoxButton::drawButton( QPainter *p ) { QStyle::SFlags flags = QStyle::Style_Default; const QColorGroup &cg = colorGroup(); if ( isEnabled() ) flags |= QStyle::Style_Enabled; if ( selected ) flags |= QStyle::Style_Selected; if ( hasFocus() ) flags |= QStyle::Style_HasFocus; if (isDown()) flags |= QStyle::Style_Down; style().drawControl( QStyle::CE_ToolBoxTab, p, parentWidget(), rect(), cg, flags ); QPixmap pm = icon.pixmap( QIconSet::Small, isEnabled() ? QIconSet::Normal : QIconSet::Disabled ); QRect cr = style().subRect( QStyle::SR_ToolBoxTabContents, this ); QRect tr, ir; int ih = 0; if ( pm.isNull() ) { tr = cr; tr.addCoords( 4, 0, -8, 0 ); } else { int iw = pm.width() + 4; ih = pm.height(); ir = QRect( cr.left() + 4, cr.top(), iw + 2, ih ); tr = QRect( ir.right(), cr.top(), cr.width() - ir.right() - 4, cr.height() ); } if ( selected && style().styleHint( QStyle::SH_ToolBox_SelectedPageTitleBold ) ) { QFont f( p->font() ); f.setBold( TRUE ); p->setFont( f ); } QString txt; if ( p->fontMetrics().width(label) < tr.width() ) { txt = label; } else { txt = label.left( 1 ); int ew = p->fontMetrics().width( "..." ); int i = 1; while ( p->fontMetrics().width( txt ) + ew + p->fontMetrics().width( label[i] ) < tr.width() ) txt += label[i++]; txt += "..."; } if ( ih ) p->drawPixmap( ir.left(), (height() - ih) / 2, pm ); QToolBox *tb = (QToolBox*)parentWidget(); const QColor* fill = 0; if ( selected && style().styleHint( QStyle::SH_ToolBox_SelectedPageTitleBold ) && tb->backgroundMode() != NoBackground ) fill = &cg.color( QPalette::foregroundRoleFromMode( tb->backgroundMode() ) ); int alignment = AlignLeft | AlignVCenter | ShowPrefix; if (!style().styleHint(QStyle::SH_UnderlineAccelerator, this)) alignment |= NoAccel; style().drawItem( p, tr, alignment, cg, isEnabled(), 0, txt, -1, fill ); if ( !txt.isEmpty() && hasFocus() ) style().drawPrimitive( QStyle::PE_FocusRect, p, tr, cg ); }