QIconSet menuIconSet(const QString& icon) { QIconSet iconset; int iconSize = KickerSettings::menuEntryHeight(); if (iconSize < 0) { return iconset; } if (icon != "unknown") { if (iconSize > 0) { iconset = KGlobal::iconLoader()->loadIconSet(icon, KIcon::NoGroup, iconSize, true); } else if (iconSize == 0) { QPixmap normal = KGlobal::iconLoader()->loadIcon(icon, KIcon::Small, 0, KIcon::DefaultState, 0, true); QPixmap active = KGlobal::iconLoader()->loadIcon(icon, KIcon::Small, 0, KIcon::ActiveState, 0, true); // make sure they are not larger than 20x20 if (normal.width() > 20 || normal.height() > 20) { normal.convertFromImage(normal.convertToImage().smoothScale(20,20)); } if (active.width() > 20 || active.height() > 20) { active.convertFromImage(active.convertToImage().smoothScale(20,20)); } iconset.setPixmap(normal, QIconSet::Small, QIconSet::Normal); iconset.setPixmap(active, QIconSet::Small, QIconSet::Active); } } if (iconset.isNull()) { QPixmap pix(iconSize, iconSize); QBitmap map(iconSize, iconSize, true); pix.setMask(map); iconset = QIconSet(pix, pix); } return iconset; }
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()); }
KReferDialog::KReferDialog( KPhoneView * phv,int kcwn,QString uPrefix,QWidget *parent, const char *name ) : QDialog( parent, name, true ) { phoneView=phv; kcwNumber= kcwn; userPrefix=uPrefix; phoneBook = 0; QVBox *vbox = new QVBox( this ); vbox->setMargin( 3 ); vbox->setSpacing( 3 ); QVBoxLayout *vboxl = new QVBoxLayout( this, 5 ); vboxl->addWidget( vbox ); (void) new QLabel( tr("Refer-to URI:"), vbox ); touri = new QLineEdit( vbox ); touri->setMinimumWidth( fontMetrics().maxWidth() * 20 ); QHBoxLayout *buttonBox; buttonBox = new QHBoxLayout( vboxl, 6 ); loadUri = new QPushButton( "", this ); QIconSet icon; icon.setPixmap(SHARE_DIR "/icons/phonebook.png", QIconSet::Automatic ); loadUri->setIconSet( icon ); loadUri->setFixedWidth( loadUri->fontMetrics().maxWidth() * 2 ); buttonBox->addWidget( loadUri ); helpPushButton = new QPushButton( this, tr("help button") ); helpPushButton->setText( tr("&help...") ); helpPushButton->setEnabled( FALSE ); buttonBox->addWidget( helpPushButton ); QSpacerItem *spacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); buttonBox->addItem( spacer ); okPushButton = new QPushButton( this, tr("ok button") ); okPushButton->setText( "OK" ); okPushButton->setDefault( TRUE ); buttonBox->addWidget( okPushButton ); cancelPushButton = new QPushButton( this,tr( "cancel button") ); cancelPushButton->setText( tr("Cancel") ); cancelPushButton->setAccel( Key_Escape ); buttonBox->addWidget( cancelPushButton ); connect( loadUri, SIGNAL( clicked() ), this, SLOT( getUri() ) ); connect( okPushButton, SIGNAL( clicked() ), this, SLOT( slotOk() ) ); connect( cancelPushButton, SIGNAL( clicked() ), this, SLOT( slotCancel() ) ); }
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; }
CToolButton::CToolButton( const QIconSet & pOff, const QPixmap & pOn, const QString & textLabel, const QString & grouptext, QObject * receiver, const char * slot, QToolBar * parent, const char * name) : QToolButton(pOff, textLabel, grouptext, receiver, slot, parent, name) { popup = NULL; #if QT_VERSION < 300 setOnIconSet(pOn); #else QIconSet icon = pOff; icon.setPixmap(pOn, QIconSet::Small, QIconSet::Normal, QIconSet::On); setIconSet(icon); #endif }
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()); }
void Kooka::setupActions() { KStdAction::print(this, SLOT(filePrint()), actionCollection()); KStdAction::quit(this , SLOT(close()), actionCollection()); KStdAction::keyBindings(guiFactory(), SLOT(configureShortcuts()), actionCollection()); KStdAction::configureToolbars(this, SLOT(optionsConfigureToolbars()), actionCollection()); KStdAction::preferences(this, SLOT(optionsPreferences()), actionCollection()); m_view->createDockMenu(actionCollection(), this, "settings_show_docks" ); /* Image Viewer action Toolbar - OCR, Scaling etc. */ (void) new KAction(i18n("&OCR Image..."), "ocr", CTRL+Key_O, m_view, SLOT(doOCR()), actionCollection(), "ocrImage" ); (void) new KAction(i18n("O&CR on Selection..."), "ocr-select", CTRL+Key_C, m_view, SLOT(doOCRonSelection()), actionCollection(), "ocrImageSelect" ); KAction *act; act = new KAction(i18n("Scale to W&idth"), "scaletowidth", CTRL+Key_I, m_view, SLOT( slIVScaleToWidth()), actionCollection(), "scaleToWidth" ); m_view->connectViewerAction( act ); act = new KAction(i18n("Scale to &Height"), "scaletoheight", CTRL+Key_H, m_view, SLOT( slIVScaleToHeight()), actionCollection(), "scaleToHeight" ); m_view->connectViewerAction( act ); act = new KAction(i18n("Original &Size"), "scaleorig", CTRL+Key_S, m_view, SLOT( slIVScaleOriginal()), actionCollection(), "scaleOriginal" ); m_view->connectViewerAction( act ); #ifdef QICONSET_HONOUR_ON_OFF /* The Toggleaction does not seem to handle the on/off icon from QIconSet */ QIconSet lockSet; lockSet.setPixmap(BarIcon("lock") , QIconSet::Automatic, QIconSet::Normal, QIconSet::On ); lockSet.setPixmap(BarIcon("unlock"), QIconSet::Automatic, QIconSet::Normal, QIconSet::Off); act = new KToggleAction ( i18n("Keep &Zoom Setting"), lockSet, CTRL+Key_Z, actionCollection(), "keepZoom" ); #else act = new KToggleAction( i18n("Keep &Zoom Setting"), BarIcon("lockzoom"), CTRL+Key_Z, actionCollection(), "keepZoom" ); #endif connect( act, SIGNAL( toggled( bool ) ), m_view->getImageViewer(), SLOT(setKeepZoom(bool))); m_view->connectViewerAction( act ); /* thumbview and gallery actions */ act = new KAction(i18n("Set Zoom..."), "viewmag", 0, m_view, SLOT( slIVShowZoomDialog()), actionCollection(), "showZoomDialog" ); m_view->connectViewerAction( act ); (void) new KAction(i18n("Create From Selectio&n"), "crop", CTRL+Key_N, m_view, SLOT( slCreateNewImgFromSelection() ), actionCollection(), "createFromSelection" ); (void) new KAction(i18n("Mirror Image &Vertically"), "mirror-vert", CTRL+Key_V, this, SLOT( slMirrorVertical() ), actionCollection(), "mirrorVertical" ); (void) new KAction(i18n("&Mirror Image Horizontally"), "mirror-horiz", CTRL+Key_M, this, SLOT( slMirrorHorizontal() ), actionCollection(), "mirrorHorizontal" ); (void) new KAction(i18n("Mirror Image &Both Directions"), "mirror-both", CTRL+Key_B, this, SLOT( slMirrorBoth() ), actionCollection(), "mirrorBoth" ); (void) new KAction(i18n("Open Image in &Graphic Application..."), "fileopen", CTRL+Key_G, m_view, SLOT( slOpenCurrInGraphApp() ), actionCollection(), "openInGraphApp" ); act = new KAction(i18n("&Rotate Image Clockwise"), "rotate_cw", CTRL+Key_R, this, SLOT( slRotateClockWise() ), actionCollection(), "rotateClockwise" ); m_view->connectViewerAction( act ); act = new KAction(i18n("Rotate Image Counter-Clock&wise"), "rotate_ccw", CTRL+Key_W, this, SLOT( slRotateCounterClockWise() ), actionCollection(), "rotateCounterClockwise" ); m_view->connectViewerAction( act ); act = new KAction(i18n("Rotate Image 180 &Degrees"), "rotate", CTRL+Key_D, this, SLOT( slRotate180() ), actionCollection(), "upsitedown" ); m_view->connectViewerAction( act ); /* Gallery actions */ act = new KAction(i18n("&Create Folder..."), "folder_new", 0, m_view->gallery(), SLOT( slotCreateFolder() ), actionCollection(), "foldernew" ); m_view->connectGalleryAction( act ); act = new KAction(i18n("&Save Image..."), "filesave", 0, m_view->gallery(), SLOT( slotExportFile() ), actionCollection(), "saveImage" ); m_view->connectGalleryAction( act ); act = new KAction(i18n("&Import Image..."), "inline_image", 0, m_view->gallery(), SLOT( slotImportFile() ), actionCollection(), "importImage" ); m_view->connectGalleryAction( act ); act = new KAction(i18n("&Delete Image"), "edittrash", 0, m_view->gallery(), SLOT( slotDeleteItems() ), actionCollection(), "deleteImage" ); m_view->connectGalleryAction( act ); act = new KAction(i18n("&Unload Image"), "fileclose", 0, m_view->gallery(), SLOT( slotUnloadItems() ), actionCollection(), "unloadImage" ); m_view->connectGalleryAction( act ); #if 0 /* not yet supported actions - coming post 3.1 */ (void) new KAction(i18n("&Load Scan Parameters"), "bookmark_add", CTRL+Key_L, m_view, SLOT(slLoadScanParams()), actionCollection(), "loadscanparam" ); (void) new KAction(i18n("Save &Scan Parameters"), "bookmark_add", CTRL+Key_S, m_view, SLOT(slSaveScanParams()), actionCollection(), "savescanparam" ); #endif (void) new KAction(i18n("Select Scan Device"), "scanner", 0, m_view, SLOT( slSelectDevice()), actionCollection(), "selectsource" ); (void) new KAction( i18n("Enable All Warnings && Messages"), 0, this, SLOT(slEnableWarnings()), actionCollection(), "enable_msgs"); m_saveOCRTextAction = new KAction( i18n("Save OCR Res&ult Text"), "filesaveas", CTRL+Key_U, m_view, SLOT(slSaveOCRResult()), actionCollection(), "saveOCRResult"); }
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; }
///// getIconSet ////////////////////////////////////////////////////////////// QIconSet IconSets::getIconSet(const IconSetID id) /// Returns the icon set associated with the given id. { initialize(); QIconSet result; if(id == Open) { result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(OpenNormal)), QIconSet::Automatic); result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(OpenActive)), QIconSet::Large, QIconSet::Active); result.setPixmap(QPixmap(QPixmap::fromMimeSource(factoryNames.at(OpenActive)).convertToImage().smoothScale(22, 22)), QIconSet::Small, QIconSet::Active); } else if(id == Save) { result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(SaveNormal)), QIconSet::Automatic, QIconSet::Normal); result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(SaveDisabled)), QIconSet::Automatic, QIconSet::Disabled); result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(SaveActive)), QIconSet::Large, QIconSet::Active); result.setPixmap(QPixmap(QPixmap::fromMimeSource(factoryNames.at(SaveActive)).convertToImage().smoothScale(22, 22)), QIconSet::Small, QIconSet::Active); } else if(id == Prefs) { result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(PrefsNormal)), QIconSet::Automatic); result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(PrefsActive)), QIconSet::Large, QIconSet::Active); result.setPixmap(QPixmap(QPixmap::fromMimeSource(factoryNames.at(PrefsActive)).convertToImage().smoothScale(22, 22)), QIconSet::Small, QIconSet::Active); } else if(id == Image) { result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(ImageNormal)), QIconSet::Automatic, QIconSet::Normal); result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(ImageDisabled)), QIconSet::Automatic, QIconSet::Disabled); result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(ImageActive)), QIconSet::Large, QIconSet::Active); result.setPixmap(QPixmap(QPixmap::fromMimeSource(factoryNames.at(ImageActive)).convertToImage().smoothScale(22, 22)), QIconSet::Small, QIconSet::Active); } else if(id == Help) { result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(HelpNormal)), QIconSet::Automatic); result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(HelpActive)), QIconSet::Large, QIconSet::Active); result.setPixmap(QPixmap(QPixmap::fromMimeSource(factoryNames.at(HelpActive)).convertToImage().smoothScale(22, 22)), QIconSet::Small, QIconSet::Active); } else if(id == WhatsThis) { result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(WhatsThisNormal)), QIconSet::Automatic); result.setPixmap(QPixmap::fromMimeSource(factoryNames.at(WhatsThisActive)), QIconSet::Large, QIconSet::Active); result.setPixmap(QPixmap(QPixmap::fromMimeSource(factoryNames.at(WhatsThisActive)).convertToImage().smoothScale(22, 22)), QIconSet::Small, QIconSet::Active); } return result; }
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 ); }
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 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 ); }