wxIcon wxGISTaskCmd::GetBitmap(void) { switch(m_subtype) { case 2: if(!m_IconStart.IsOk()) { wxImageList ImageList(16, 16, true, 10); ImageList.Add(wxBitmap(state_xpm)); m_IconStart = ImageList.GetIcon(4); } return m_IconStart; case 3: if(!m_IconStop.IsOk()) { wxImageList ImageList(16, 16, true, 10); ImageList.Add(wxBitmap(state_xpm)); m_IconStop = ImageList.GetIcon(7); } return m_IconStop; case 1: if(!m_IconInfo.IsOk()) { wxImageList ImageList(16, 16, true, 10); ImageList.Add(wxBitmap(state_xpm)); m_IconInfo = ImageList.GetIcon(0); } return m_IconInfo; case 0: default: return wxNullIcon; } }
void ThumbnailPicker::slotProcessGoogleResult(KJob *result) { //Preload ImageList with the URLs in the object's ImageList: QStringList ImageList( Object->ImageList() ); if (result->error()) { result->uiDelegate()->showErrorMessage(); result->kill(); return; } QString PageHTML(static_cast<KIO::StoredTransferJob*>(result)->data()); int index = PageHTML.indexOf( "src=\"http:", 0 ); while ( index >= 0 ) { index += 5; //move to end of "src=\"http:" marker //Image URL is everything from index to next occurrence of "\"" ImageList.append( PageHTML.mid( index, PageHTML.indexOf( "\"", index ) - index ) ); index = PageHTML.indexOf( "src=\"http:", index ); } //Total Number of images to be loaded: int nImages = ImageList.count(); if ( nImages ) { ui->SearchProgress->setMinimum( 0 ); ui->SearchProgress->setMaximum( nImages-1 ); ui->SearchLabel->setText( i18n( "Loading images..." ) ); } else { close(); return; } //Add images from the ImageList for ( int i=0; i<ImageList.size(); ++i ) { QString s( ImageList[i] ); QUrl u( ImageList[i] ); if ( u.isValid() ) { KIO::StoredTransferJob *j = KIO::storedGet( u, KIO::NoReload, KIO::HideProgressInfo ); j->setUiDelegate(0); connect( j, SIGNAL( result(KJob*) ), SLOT( slotJobResult(KJob*) ) ); } } }
//Query online sources for images of the object void ThumbnailPicker::slotFillList() { //Preload ImageList with the URLs in the object's ImageList: QStringList ImageList( Object->ImageList() ); //Query Google Image Search: KUrl gURL( "http://images.google.com/images" ); //Search for the primary name, or longname and primary name QString sName = QString("%1 ").arg( Object->name() ); if ( Object->longname() != Object->name() ) { sName = QString("%1 ").arg( Object->longname() ) + sName; } gURL.addQueryItem( "q", sName ); //add the Google-image query string //Download the google page and parse it for image URLs parseGooglePage( ImageList, gURL.prettyUrl() ); //Total Number of images to be loaded: int nImages = ImageList.count(); if ( nImages ) { ui->SearchProgress->setMinimum( 0 ); ui->SearchProgress->setMaximum( nImages-1 ); ui->SearchLabel->setText( i18n( "Loading images..." ) ); } //Add images from the ImageList for ( int i=0; i<ImageList.size(); ++i ) { QString s( ImageList[i] ); KUrl u( ImageList[i] ); if ( u.isValid() ) { KIO::StoredTransferJob *j = KIO::storedGet( u, KIO::NoReload, KIO::HideProgressInfo ); j->setUiDelegate(0); connect( j, SIGNAL( result(KJob*) ), SLOT( slotJobResult(KJob*) ) ); } } }
optional<ImageList> TableViewImpl::getImageList() { if( ! imageListImpl ) return optional<ImageList>(); return ImageList(imageListImpl); }
ImageList TreeView::images () const { return (ImageList(ImageList::proxy( TreeView_GetImageList(handle(), TVSIL_NORMAL)))); }