void PanelButton::loadIcons() { KIconLoader * ldr = KGlobal::iconLoader(); QString nm = m_iconName; KIcon::States defaultState = isEnabled() ? KIcon::DefaultState : KIcon::DisabledState; m_icon = ldr->loadIcon(nm, KIcon::Panel, m_size, defaultState, 0L, true); if (m_icon.isNull()) { nm = defaultIcon(); m_icon = ldr->loadIcon(nm, KIcon::Panel, m_size, defaultState); } if (!isEnabled()) { m_iconh = m_icon; } else { m_iconh = ldr->loadIcon(nm, KIcon::Panel, m_size, KIcon::ActiveState, 0L, true); } m_iconz = ldr->loadIcon(nm, KIcon::Panel, KIcon::SizeHuge, defaultState, 0L, true ); }
KMyMoneyBriefSchedule::KMyMoneyBriefSchedule(QWidget *parent, const char *name ) : kScheduleBriefWidget(parent,name, WStyle_Customize | WStyle_NoBorder) { KIconLoader *ic = KGlobal::iconLoader(); m_nextButton->setPixmap(BarIcon(QString::fromLatin1("1rightarrow"))); m_prevButton->setPixmap(BarIcon(QString::fromLatin1("1leftarrow"))); connect(m_prevButton, SIGNAL(clicked()), this, SLOT(slotPrevClicked())); connect(m_nextButton, SIGNAL(clicked()), this, SLOT(slotNextClicked())); connect(m_closeButton, SIGNAL(clicked()), this, SLOT(hide())); connect(m_skipButton, SIGNAL(clicked()), this, SLOT(slotSkipClicked())); connect(m_buttonEnter, SIGNAL(clicked()), this, SLOT(slotEnterClicked())); KGuiItem skipGuiItem( i18n("&Skip"), QIconSet(ic->loadIcon("player_fwd", KIcon::Small, KIcon::SizeSmall)), i18n("Skip this transaction"), i18n("Use this button to skip this transaction")); m_skipButton->setGuiItem(skipGuiItem); KGuiItem enterGuiItem( i18n("&Enter"), QIconSet(ic->loadIcon("key_enter", KIcon::Small, KIcon::SizeSmall)), i18n("Record this transaction into the register"), i18n("Use this button to record this transaction")); m_buttonEnter->setGuiItem(enterGuiItem); }
/** * Initialize this object. */ PortageTreeView::PortageTreeView( QWidget* parent, const char* name ) : KListView( parent, name ) { portageTree = NULL; // load root and category item icons KIconLoader* iconLoader = KGlobal::iconLoader(); pxRootItem = iconLoader->loadIcon( ALLPACKAGESICON, KIcon::Small ); pxCategoryItem = iconLoader->loadIcon( CATEGORYICON, KIcon::Small ); this->header()->hide(); this->addColumn( "Categories" ); this->setColumnWidthMode( 0, QListView::Maximum ); this->setRootIsDecorated( true ); rootItem = new KListViewItem( this, ALLPACKAGESTEXT ); rootItem->setExpandable( true ); rootItem->setOpen( true ); rootItem->setPixmap( 0, pxRootItem ); this->setFullWidth( true ); connect( this, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(emitSelectionChanged(QListViewItem*)) ); }
KSettingsHome::KSettingsHome(QWidget* parent) : KSettingsHomeDecl(parent), m_noNeedToUpdateList(false) { m_homePageList->setSortingEnabled(false); KIconLoader* il = KIconLoader::global(); KGuiItem upButtonItem(i18nc("Move item up", "&Up"), il->loadIcon("go-up", KIconLoader::Small, KIconLoader::SizeSmall), i18n("Move selected item up"), i18n("Use this to move the selected item up by one position in the list.")); KGuiItem downButtonItem(i18n("&Down"), il->loadIcon("go-down", KIconLoader::Small, KIconLoader::SizeSmall), i18n("Move selected item down"), i18n("Use this to move the selected item down by one position in the list.")); KGuiItem::assign(m_upButton, upButtonItem); m_upButton->setEnabled(false); KGuiItem::assign(m_downButton, downButtonItem); m_downButton->setEnabled(false); // connect this, so that the list gets loaded once the edit field is filled connect(kcfg_ItemList, SIGNAL(textChanged(QString)), this, SLOT(slotLoadItems())); connect(m_homePageList, SIGNAL(itemSelectionChanged()), this, SLOT(slotSelectHomePageItem())); connect(m_homePageList, SIGNAL(clicked(QModelIndex)), this, SLOT(slotUpdateItemList())); connect(m_upButton, SIGNAL(clicked()), this, SLOT(slotMoveUp())); connect(m_downButton, SIGNAL(clicked()), this, SLOT(slotMoveDown())); // Don't show it to the user, we only need it to load and save the settings kcfg_ItemList->hide(); }
ClusterView::ClusterView(KlustersDoc& doc,KlustersView& view,QColor backgroundColor,int timeInterval,KStatusBar * statusBar,QWidget* parent, const char* name, int minSize, int maxSize, int windowTopLeft ,int windowBottomRight, int border) : ViewWidget(doc,view,backgroundColor,statusBar,parent,name,minSize,maxSize,windowTopLeft,windowBottomRight,border), selectionPolygon(0), nbSelectionPoints(0),polygonClosed(false),existLastMovingLine(false) { //Set the default mode mode = ZOOM; //Initialize internal variables timeDimension = doc.data().timeDimension(); samplingInterval = doc.data().intervalOfSampling(); setTimeStepInSecond(timeInterval); //Update the dimension of the window and the values of dimensionX and dimensionY updatedDimensions(view.abscissaDimension(),view.ordinateDimension()); KIconLoader *loader = KGlobal::iconLoader(); newClusterCursor = QCursor(loader->loadIcon("new_cluster_cursor", KIcon::User),0,0); newClustersCursor = QCursor(loader->loadIcon("new_clusters_cursor", KIcon::User),0,0); deleteNoiseCursor = QCursor(loader->loadIcon("delete_noise_cursor", KIcon::User),0,0); deleteArtefactCursor = QCursor(loader->loadIcon("delete_artefact_cursor", KIcon::User),0,0); selectTimeCursor = QCursor(loader->loadIcon("select_time_cursor", KIcon::User),0,0); //The default tool is the zoom. setCursor(zoomCursor); //Allowed the mouse tracking to draw the tracking lines and write the mouse coordinates setMouseTracking(true) ; }
void testUnknownIconNotCached() { // This is a test to ensure that "unknown" icons do not pin themselves // in the icon loader. Or in other words, if an "unknown" icon is // returned, but the appropriate icon is subsequently installed // properly, the next request for that icon should return the new icon // instead of the unknown icon. // Since we'll need to create an icon we'll need a temporary directory, // and we want that established before creating the icon loader. QString tempRoot = QDir::tempPath() + QLatin1String("/kiconloader_unittest"); QString temporaryDir = tempRoot + QLatin1String("/hicolor/22x22/actions"); QVERIFY(QDir::root().mkpath(temporaryDir)); QVERIFY(KGlobal::dirs()->addResourceDir("icon", tempRoot, false)); KIconLoader iconLoader; // First find an existing icon. The only ones installed for sure by // kdelibs are the kimproxy ones. QString loadedIconPath = iconLoader.iconPath( QLatin1String("presence_online"), KIconLoader::DefaultState, false /* Ensure "unknown" icon can't be returned */ ); QVERIFY(!loadedIconPath.isEmpty()); QString nonExistingIconName = QLatin1String("fhqwhgads_homsar"); // Find a non-existent icon, allowing unknown icon to be returned QPixmap nonExistingIcon = iconLoader.loadIcon( nonExistingIconName, KIconLoader::Toolbar); QCOMPARE(nonExistingIcon.isNull(), false); // Install the existing icon by copying. QFileInfo existingIconInfo(loadedIconPath); QString newIconPath = temporaryDir + QLatin1String("/") + nonExistingIconName + QLatin1String(".png"); QVERIFY(QFile::copy(loadedIconPath, newIconPath)); // Verify the icon can now be found. QPixmap nowExistingIcon = iconLoader.loadIcon( nonExistingIconName, KIconLoader::Toolbar); QVERIFY(nowExistingIcon.cacheKey() != nonExistingIcon.cacheKey()); QCOMPARE(iconLoader.iconPath(nonExistingIconName, KIconLoader::Toolbar), newIconPath); // Cleanup QFile::remove(newIconPath); QStringList entries(QDir(tempRoot).entryList( QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed)); Q_FOREACH(const QString &dirName, entries) { QDir::root().rmdir(dirName); }
QPixmap KWalletFolderItem::getFolderIcon(KIcon::Group group){ KIconLoader *loader = KGlobal::instance()->iconLoader(); QPixmap pix = loader->loadIcon( _name, group, 0, KIcon::DefaultState, 0, true ); if (pix.isNull()) pix = loader->loadIcon( _name.lower(), group, 0, KIcon::DefaultState, 0, true); if (pix.isNull()) pix = loader->loadIcon( "folder_red", group, 0, KIcon::DefaultState, 0, true); return pix; }
QPixmap KWalletFolderItem::getFolderIcon(KIconLoader::Group group){ KIconLoader *loader = KIconLoader::global(); QPixmap pix = loader->loadIcon( _name, group, 0, KIconLoader::DefaultState, QStringList(),0, true ); if (pix.isNull()) pix = loader->loadIcon( _name.toLower(), group, 0, KIconLoader::DefaultState, QStringList(),0, true); if (pix.isNull()) pix = loader->loadIcon( QLatin1String( "folder-red" ), group, 0, KIconLoader::DefaultState, QStringList(),0, true); return pix; }
void ViewWidget::icoLoad() { KIconLoader iconLoader; QIcon icoLeft(iconLoader.loadIcon(QString("object-rotate-left"),(KIconLoader::Group)4)); ui->pushButton_2->setIcon(icoLeft); QIcon icoRight(iconLoader.loadIcon(QString("object-rotate-right"),(KIconLoader::Group)4)); ui->pushButton_3->setIcon(icoRight); QIcon icoDownload(iconLoader.loadIcon(QString("download"),(KIconLoader::Group)4)); ui->pushButton_4->setIcon(icoDownload); QIcon icoDel(iconLoader.loadIcon(QString("edit-delete"),(KIconLoader::Group)4)); ui->pushButton->setIcon(icoDel); }
int main(int argc, char *argv[]) { KAboutData about("kiconloadertest", 0, ki18n("kiconloadertest"), "version"); KCmdLineArgs::init(argc, argv, &about); KApplication app; KIconLoader * mpLoader = KIconLoader::global(); KIconLoader::Context mContext = KIconLoader::Application; QTime dt; dt.start(); int count = 0; for ( int mGroup = 0; mGroup < KIconLoader::LastGroup ; ++mGroup ) { kDebug() << "queryIcons " << mGroup << "," << mContext; const QStringList filelist = mpLoader->queryIcons(mGroup, mContext); kDebug() << " -> found " << filelist.count() << " icons."; int i=0; for(QStringList::ConstIterator it = filelist.begin(); it != filelist.end() /*&& i<10*/; ++it, ++i ) { //kDebug() << ( i==9 ? "..." : (*it) ); mpLoader->loadIcon( (*it), (KIconLoader::Group)mGroup ); ++count; } } kDebug() << "Loading " << count << " icons took " << (float)(dt.elapsed()) / 1000 << " seconds"; }
void SlidePlaybackWidget::slotPlayButtonToggled() { if (m_playButton->isChecked()) { m_canHide = false; KIconLoader* loader = KIconLoader::global(); m_playButton->setIcon(loader->loadIcon("media-playback-start", KIconLoader::NoGroup, 22)); emit signalPause(); } else { m_canHide = true; KIconLoader* loader = KIconLoader::global(); m_playButton->setIcon(loader->loadIcon("media-playback-pause", KIconLoader::NoGroup, 22)); emit signalPlay(); } }
void setState(enum STATE state) { m_state = state; KIconLoader *loader = KIconLoader::global(); switch (state) { case InitialState: setIcon(0, QIcon()); break; case SaveOKState: setIcon(0, loader->loadIcon("dialog-ok", KIconLoader::NoGroup,/*height()*/16)); // "ok" icon should probably be "dialog-success", but we don't have that icon in KDE 4.0 break; case SaveFailedState: setIcon(0, loader->loadIcon("dialog-error", KIconLoader::NoGroup,/*height()*/16)); break; } }
KFFOpt_scenery::KFFOpt_scenery( QWidget *parent ) : KFFOpt_skeleton( parent ) { KIconLoader loader; ui_widget.setupUi ( this ); m_aircraftIcon = loader.loadIcon( "kffplane", KIconLoader::Small ); m_weatherIcon = loader.loadIcon( "kffweather", KIconLoader::Small ); m_shipIcon = loader.loadIcon( "kffboat", KIconLoader::Small ); m_trainIcon = loader.loadIcon( "kfftrain", KIconLoader::Small ); m_unknowIcon = KIconLoader::unknown(); connect( ui_widget.btn_refresh, SIGNAL( clicked() ), SLOT( reload() ) ); }
QueueDialog::QueueDialog(bt::QueueManager* qm, QWidget *parent, const char *name) :QueueDlg(parent, name) { KIconLoader* iload = KGlobal::iconLoader(); m_tabs->setTabIconSet(m_tabs->page(0), iload->loadIconSet("down", KIcon::Small)); m_tabs->setTabIconSet(m_tabs->page(1), iload->loadIconSet("up", KIcon::Small)); logo->setPixmap(iload->loadIcon("ktqueuemanager", KIcon::Desktop)); connect(downloadList, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(downloadList_currentChanged( QListViewItem* ))); connect(seedList, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(seedList_currentChanged( QListViewItem* ))); if(downloadList->firstChild()) downloadList->setCurrentItem(downloadList->firstChild()); if(seedList->firstChild()) seedList->setCurrentItem(seedList->firstChild()); btnMoveUp->setPixmap(iload->loadIcon("up", KIcon::Small)); btnMoveDown->setPixmap(iload->loadIcon("down", KIcon::Small)); this->qman = qm; QPtrList<kt::TorrentInterface>::iterator it = qman->begin(); for( ; it != qman->end(); ++it) { TorrentInterface* tc = *it; TorrentStatus ts = tc->getStats().status; if(ts == kt::SEEDING || ts == kt::DOWNLOAD_COMPLETE || ts == kt::SEEDING_COMPLETE || tc->getStats().completed) { QueueItem* item = new QueueItem(tc, seedList); seedList->insertItem(item); } else { QueueItem* item = new QueueItem(tc, downloadList); downloadList->insertItem(item); } } }
void SlidePlaybackWidget::slotNexPrevClicked() { if (!m_playButton->isChecked()) { m_playButton->setChecked(true); m_canHide = false; KIconLoader* loader = KIconLoader::global(); m_playButton->setIcon(loader->loadIcon("media-playback-start", KIconLoader::NoGroup, 22)); emit signalPause(); } }
QPixmap Util::getSystemIcon( const QString& name ) { #ifdef QT_ONLY QPixmap pix; pix.convertFromImage( qembed_findImage( name ) ); return pix; #else KIconLoader loader; return loader.loadIcon( name, KIcon::Toolbar); #endif }
void KFFWin_Flightplan::showFavoriteContextMenu( const QPoint &pos ) { KIconLoader loader; QPixmap pixmap; QIcon icon; QAction* remove; QAction* clear; QAction* edit; QAction* moveup; QAction* movedown; QAction* calc; KMenu menu( this ); pixmap = loader.loadIcon( "edit-delete", KIconLoader::Small ); icon.addPixmap( pixmap ); remove = new QAction( icon, i18n( "&Remove waypoint" ), this ); remove->setStatusTip( i18n( "Remove this waypoint" ) ); connect( remove, SIGNAL( triggered() ), this, SLOT( removeNavaids() ) ); pixmap = loader.loadIcon( "edit-clear-list", KIconLoader::Small ); icon.addPixmap( pixmap ); clear = new QAction( icon, i18n( "&Clear all waypoints" ), this ); clear->setStatusTip( i18n( "Clear waypoint list" ) ); connect( clear, SIGNAL( triggered() ), ui_widget.treewidget_navaids, SLOT( clear() ) ); pixmap = loader.loadIcon( "edit-rename", KIconLoader::Small ); icon.addPixmap( pixmap ); edit = new QAction( icon, i18n( "&Edit waypoint altitude" ), this ); edit->setStatusTip( i18n( "Edit this waypoint" ) ); connect( edit, SIGNAL( triggered() ), this, SLOT( edit() ) ); pixmap = loader.loadIcon( "arrow-up", KIconLoader::Small ); icon.addPixmap( pixmap ); moveup = new QAction( icon, i18n( "&Move waypoint up" ), this ); moveup->setStatusTip( i18n( "Move this waypoint up" ) ); connect( moveup, SIGNAL( triggered() ), this, SLOT( moveItemUp() ) ); pixmap = loader.loadIcon( "arrow-down", KIconLoader::Small ); icon.addPixmap( pixmap ); movedown = new QAction( icon, i18n( "&Move waypoint down" ), this ); movedown->setStatusTip( i18n( "Move this waypoint down" ) ); connect( movedown, SIGNAL( triggered() ), this, SLOT( moveItemDown() ) ); pixmap = loader.loadIcon( "view-refresh", KIconLoader::Small ); icon.addPixmap( pixmap ); calc = new QAction( icon, i18n( "&Recalculate Distance" ), this ); calc->setStatusTip( i18n( "Force recalculate distance between all waypoints" ) ); connect( calc, SIGNAL( triggered() ), this, SLOT( recalculate() ) ); menu.addAction( remove ); menu.addAction( edit ); menu.addSeparator(); menu.addAction( clear ); menu.addSeparator(); menu.addAction( moveup ); menu.addAction( movedown ); menu.addSeparator(); menu.addAction( calc ); menu.exec( mapToGlobal( pos + ui_widget.treewidget_navaids->pos() ) ); }
CdWidget::CdWidget( const QString &ad, int port, int info, const QString &tspath, QWidget *parent, QObject *objParent, const char *name ) : KaffeineInput( objParent, name ) { mainWidget = new QVBox( parent ); mainWidget->setSizePolicy( QSizePolicy (QSizePolicy::Preferred, QSizePolicy::Preferred) ); split = new QSplitter( mainWidget ); split->setOpaqueResize( true ); playerBox = new QVBox( split ); playerBox->setMinimumWidth( 200 ); channelsLb = new QListBox( split ); split->moveToFirst( channelsLb ); channelsLb->setSizePolicy( QSizePolicy (QSizePolicy::Preferred, QSizePolicy::MinimumExpanding) ); split->setResizeMode( channelsLb, QSplitter::KeepSize ); cdAddress = ad; cdPort = port; cdInfo = info; cdShiftDir = tspath; if ( !cdShiftDir.endsWith("/") ) cdShiftDir+= "/"; cleaner = new CdCleaner( cdShiftDir ); chan.setAutoDelete( true ); KIconLoader *icon = new KIconLoader(); tvPix = icon->loadIcon( "kdvbtv", KIcon::Small ); raPix = icon->loadIcon( "kdvbra", KIcon::Small ); delete icon; listen = new CdListen(); listen->go( cdAddress, cdInfo ); fifoName = QDir::homeDirPath()+"/.kaxclient.ts"; QFile f( fifoName ); if ( f.exists() ) f.remove(); if ( (mkfifo( fifoName.ascii(), 0644 ))<0 ) { perror( fifoName.latin1() ); fifoName = ""; dump = 0; } else { dump = new CdDump( fifoName ); connect( channelsLb, SIGNAL(selected(const QString &)), this, SLOT(channelSelected(const QString &)) ); connect( listen, SIGNAL(listChanged(const QString&)), this, SLOT(updateList(const QString&)) ); } lastChannel = 0; enableLive( false ); loadConfig( KGlobal::config() ); }
const QIconSet *Icons::getIcon(const char *name) { if (name == NULL) return NULL; PIXMAP_MAP::iterator it = icons.find(name); if (it == icons.end()){ if (!strcmp(name, "online")){ unsigned i; for (i = 0; i < getContacts()->nClients(); i++){ Client *client = getContacts()->getClient(i); const QIconSet *icon = Icon(client->protocol()->description()->icon); if (icon) return addIcon("online", *icon, false); } if (i >= getContacts()->nClients()){ const QIconSet *icon = Icon("licq"); if (icon) return addIcon("online", *icon, false); } } if (!strcmp(name, "offline")){ const QIconSet *icon = Icon("online"); if (icon){ QPixmap pict = icon->pixmap(QIconSet::Small, QIconSet::Normal); pict = swapRG(pict); QIconSet offline(pict); return addIcon("offline", offline, false); } } if (!strcmp(name, "inactive")){ const QIconSet *icon = Icon("online"); if (icon){ QPixmap pict = icon->pixmap(QIconSet::Small, QIconSet::Normal); pict = setGB(pict); QIconSet inactive(pict); return addIcon("inactive", inactive, false); } } return NULL; } PictDef &p = (*it).second; #ifdef USE_KDE if (p.bSystem){ KIconLoader iconLoader; QPixmap pict = iconLoader.loadIcon(name, KIcon::Small, -32, KIcon::DefaultState, NULL, true); if (!pict.isNull()) p.icon = QIconSet(pict); } #endif return &p.icon; }
void AddBackupWizard::initView() { KIconLoader* loader = KIconLoader::global(); setWindowIcon( loader->loadIcon( "tools-wizard", KIconLoader::Small )); page1 = new AddBackupWizardPage1(this); addPage(page1); page2 = new AddBackupWizardPage2(this); addPage(page2); page3 = new AddBackupWizardPage3(this); addPage(page3); }
void ModuleTitle::showTitleFor(ConfigModule *config) { if(!config) return; QWhatsThis::remove(this); QWhatsThis::add(this, config->comment()); KIconLoader *loader = KGlobal::instance()->iconLoader(); QPixmap icon = loader->loadIcon(config->icon(), KIcon::NoGroup, 22); m_icon->setPixmap(icon); m_name->setText(config->moduleName()); show(); }
/** * Construct the popup * Add extra widgets to the passive popup & connect buttons to mainwindow signals. */ OSUpdaterPopup::OSUpdaterPopup(QWidget * parent,MainWindow * mainWindow) : KPassivePopup(parent) { setTimeout(30000); _popupLayout = new QVBoxLayout(this, 11, 20, "popupLayout"); _titleLayout = new QHBoxLayout(_popupLayout,KDialog::spacingHint(),"titleLayout"); _title = new QLabel("<b>openSUSE updater.</b>",this); _title->setTextFormat(Qt::RichText); _title->setAlignment(Qt::SingleLine); _closeButton = new QPushButton("x",this,"closebutton"); _closeButton->setMinimumSize(QSize(20,20)); _closeButton->setMaximumSize(QSize(20,20)); connect(_closeButton, SIGNAL(clicked()),this, SLOT(hide())); _titleLayout->addWidget(_title); _titleLayout->addStretch(); _titleLayout->addWidget(_closeButton); _description = new QLabel(this); KIconLoader *loader = KGlobal::iconLoader(); QPixmap icon = loader->loadIcon("msg_warning",KIcon::Panel); _iconLabel = new QLabel(this); _iconLabel->setPixmap(icon); _descriptionLayout = new QHBoxLayout(_popupLayout,KDialog::spacingHint(),"descriptionlayout"); _descriptionLayout->addWidget(_iconLabel); _descriptionLayout->addWidget(_description); _buttonLayout = new QHBoxLayout(_popupLayout,KDialog::spacingHint(),"buttonLayout"); _installButton = new QPushButton(i18n("Install"),this,"installbutton"); _cancelButton = new QPushButton(i18n("Ignore"),this,"ignorebutton"); connect(_cancelButton, SIGNAL(clicked()),this, SLOT(hide())); connect(_installButton, SIGNAL(clicked()),mainWindow, SIGNAL(startInstall())); connect(_installButton, SIGNAL(clicked()),this, SLOT(hide())); _buttonLayout->addStretch(); _buttonLayout->addWidget(_installButton); _buttonLayout->addWidget(_cancelButton); _buttonLayout->addStretch(); }
void InformationPanelContent::showItems(const KFileItemList& items) { m_pendingPreview = false; KIconLoader iconLoader; QPixmap icon = iconLoader.loadIcon("dialog-information", KIconLoader::NoGroup, KIconLoader::SizeEnormous); m_preview->setPixmap(icon); setNameLabelText(i18ncp("@label", "%1 item selected", "%1 items selected", items.count())); if (m_metaDataWidget) { m_metaDataWidget->setItems(items); } m_phononWidget->hide(); m_item = KFileItem(); }
/** * Initialize this object. * @param scanner A copy of this scanner will be kept * to retrieve detailed package info. */ PakooPackageListView::PakooPackageListView( QWidget* parent, const char* name, PackageScanner* scanner ) : KListView( parent, name ) { this->addColumn( i18n("Package") ); this->addColumn( i18n("Description") ); this->setRootIsDecorated( true ); this->setFullWidth( true ); packageScanner = new PackageScanner( scanner ); parallelScanning = true; // you may set this to false when debugging packageCategoryScanner = new PackageScanner( scanner ); packageInstalledScanner = new PackageScanner( scanner ); if( parallelScanning == true ) { packageCategoryScanner->setFilterInstalled( true, false ); packageInstalledScanner->setFilterInstalled( true, true ); } portageTree = NULL; currentPackage = NULL; loadedPackages = 0; installedPackages = 0; totalPackages = 0; // Load root and category item icons KIconLoader* iconLoader = KGlobal::iconLoader(); pxCategoryItem = iconLoader->loadIcon( CATEGORYICON, KIcon::Small ); pxPackageItem = iconLoader->loadIcon( PACKAGEICON, KIcon::Small ); pxPackageItemInstalled = iconLoader->loadIcon( PACKAGEICON_INSTALLED, KIcon::Small ); pxPackageItemUpdatable = iconLoader->loadIcon( PACKAGEICON_UPDATABLE, KIcon::Small ); pxVersionItem = iconLoader->loadIcon( VERSIONICON, KIcon::Small ); pxVersionItemInstalled = iconLoader->loadIcon( VERSIONICON_INSTALLED, KIcon::Small ); pxVersionItemNotAvailable = iconLoader->loadIcon( VERSIONICON_NOTAVAILABLE, KIcon::Small ); // Translate item selections into package[,version] selection signal. connect( this, SIGNAL( selectionChanged(QListViewItem*) ), this, SLOT( emitSelectionChanged(QListViewItem*) ) ); // Add the versions only when the user wants to see them, which brings // a) slightly better performance, and b) better column auto-resizing. connect( this, SIGNAL( expanded(QListViewItem*) ), this, SLOT( insertVersionItems(QListViewItem*) ) ); }
const QIconSet *Icons::getBigIcon(const char *name) { PIXMAP_MAP::iterator it = bigIcons.find(name); if (it == bigIcons.end()){ if (!strcmp(name, "online")){ const QIconSet *icon = BigIcon("licq"); if (icon) return addBigIcon("online", *icon, false); } if (!strcmp(name, "offline")){ const QIconSet *icon = BigIcon("online"); if (icon){ QPixmap pict = icon->pixmap(QIconSet::Large, QIconSet::Normal); pict = swapRG(pict); QIconSet offline(pict); return addBigIcon("offline", offline, false); } } if (!strcmp(name, "inactive")){ const QIconSet *icon = BigIcon("online"); if (icon){ QPixmap pict = icon->pixmap(QIconSet::Large, QIconSet::Normal); pict = setGB(pict); QIconSet inactive(pict); return addBigIcon("inactive", inactive, false); } } return NULL; } PictDef &p = (*it).second; #ifdef USE_KDE if (p.bSystem){ KIconLoader iconLoader; QPixmap pict = iconLoader.loadIcon(name, KIcon::Desktop, -64, KIcon::DefaultState, NULL, true); if (!pict.isNull()) p.icon = QIconSet(pict); } #endif return &p.icon; }
void InformationPanelContent::showItem(const KFileItem& item) { m_pendingPreview = false; const KUrl itemUrl = item.url(); const bool isSearchUrl = itemUrl.protocol().contains("search") && item.nepomukUri().isEmpty(); if (!applyPlace(itemUrl)) { setNameLabelText(item.text()); if (isSearchUrl) { // in the case of a search-URL the URL is not readable for humans // (at least not useful to show in the Information Panel) KIconLoader iconLoader; QPixmap icon = iconLoader.loadIcon("nepomuk", KIconLoader::NoGroup, KIconLoader::SizeEnormous); m_preview->setPixmap(icon); } else { // try to get a preview pixmap from the item... m_pendingPreview = true; // Mark the currently shown preview as outdated. This is done // with a small delay to prevent a flickering when the next preview // can be shown within a short timeframe. This timer is not started // for directories, as directory previews might fail and return the // same icon. if (!item.isDir()) { m_outdatedPreviewTimer->start(); } KIO::PreviewJob* job = KIO::filePreview(KFileItemList() << item, QSize(m_preview->width(), m_preview->height())); job->setScaleType(KIO::PreviewJob::Unscaled); connect(job, SIGNAL(gotPreview(const KFileItem&, const QPixmap&)), this, SLOT(showPreview(const KFileItem&, const QPixmap&))); connect(job, SIGNAL(failed(const KFileItem&)), this, SLOT(showIcon(const KFileItem&))); } }
void InformationPanelContent::showItems(const KFileItemList& items) { // If there is a preview job, kill it to prevent that we have jobs for // multiple items running, and thus a race condition (bug 250787). if (m_previewJob) { m_previewJob->kill(); } KIconLoader iconLoader; QPixmap icon = iconLoader.loadIcon(QStringLiteral("dialog-information"), KIconLoader::NoGroup, KIconLoader::SizeEnormous); m_preview->setPixmap(icon); setNameLabelText(i18ncp("@label", "%1 item selected", "%1 items selected", items.count())); if (m_metaDataWidget) { m_metaDataWidget->setItems(items); } m_phononWidget->hide(); m_item = KFileItem(); }
void KFFWin_Flightplan::createRestoreWidget( QString what ) { QPoint pos; QSize size, parentsize; QIcon icon; KIconLoader loader; QPixmap pixmap; int width = 500, height = 300; m_chooser = new KFFWin_Chooser( 0 ); if ( what == "save" ) { pixmap = loader.loadIcon( "document-save", KIconLoader::Small ); icon.addPixmap( pixmap ); m_chooser->setTitle( i18n( "Choose a name for this flight plan" ) ); m_chooser->setButtonText( i18n( "Save" ) ); m_chooser->setWindowTitle( i18n( "Save Flightplan" ) ); m_chooser->setType( KFFWin_Chooser::KFFDLG_SAVE ); connect( m_chooser, SIGNAL( selected( const QString & ) ), this, SLOT( saveFlightplan( const QString & ) ) ); }
AppletWidget::AppletWidget(const AppletInfo& info, bool odd, QWidget *parent) : AppletItem(parent), m_appletInfo(info), m_odd(odd), m_selected(false) { setFocusPolicy(QWidget::StrongFocus); setSelected(m_selected); itemTitle->setText("<h3>" + info.name() + "</h3>"); itemTitle->installEventFilter(this); if (info.comment() != info.name()) { itemDescription->setText(info.comment()); } itemDescription->installEventFilter(this); KIconLoader * ldr = KGlobal::iconLoader(); QPixmap icon = ldr->loadIcon(info.icon(), KIcon::Panel, KIcon::SizeLarge); itemPixmap->setPixmap(icon); itemPixmap->installEventFilter(this); }
void testLoadIconCanReturnNull() { // This is a test for the "canReturnNull" argument of KIconLoader::loadIcon(). // We try to load an icon that doesn't exist, first with canReturnNull=false (the default) // then with canReturnNull=true. KIconLoader iconLoader; // We expect a warning here... This doesn't work though, due to the extended debug //QTest::ignoreMessage(QtWarningMsg, "KIconLoader::loadIcon: No such icon \"this-icon-does-not-exist\""); QPixmap pix = iconLoader.loadIcon("this-icon-does-not-exist", KIconLoader::Desktop, 16); QVERIFY(!pix.isNull()); QCOMPARE(pix.size(), QSize(16, 16)); // Try it again, to see if the cache interfers pix = iconLoader.loadIcon("this-icon-does-not-exist", KIconLoader::Desktop, 16); QVERIFY(!pix.isNull()); QCOMPARE(pix.size(), QSize(16, 16)); // And now set canReturnNull to true pix = iconLoader.loadIcon("this-icon-does-not-exist", KIconLoader::Desktop, 16, KIconLoader::DefaultState, QStringList(), 0, true); QVERIFY(pix.isNull()); // Try getting the "unknown" icon again, to see if the above call didn't put a null icon into the cache... pix = iconLoader.loadIcon("this-icon-does-not-exist", KIconLoader::Desktop, 16); QVERIFY(!pix.isNull()); QCOMPARE(pix.size(), QSize(16, 16)); // Another one, to clear "last" cache pix = iconLoader.loadIcon("this-icon-does-not-exist-either", KIconLoader::Desktop, 16); QVERIFY(!pix.isNull()); QCOMPARE(pix.size(), QSize(16, 16)); // Now load the initial one again - do we get the warning again? pix = iconLoader.loadIcon("this-icon-does-not-exist", KIconLoader::Desktop, 16); QVERIFY(!pix.isNull()); QCOMPARE(pix.size(), QSize(16, 16)); pix = iconLoader.loadIcon("#crazyname", KIconLoader::NoGroup, 1600); QVERIFY(!pix.isNull()); QCOMPARE(pix.size(), QSize(1600, 1600)); }