void BinController::checkThumbnails(const QString thumbFolder) { // Parse all controllers and load thumbnails QMapIterator<QString, ClipController *> i(m_clipList); while (i.hasNext()) { i.next(); ClipController *ctrl = i.value(); bool foundFile = false; if (!ctrl->getClipHash().isEmpty()) { QImage img(thumbFolder + ctrl->getClipHash() + ".png"); if (!img.isNull()) { emit loadThumb(ctrl->clipId(), img, true); foundFile = true; } } if (!foundFile) { // Add clip id to thumbnail generation thread QDomDocument doc; ctrl->getProducerXML(doc); QDomElement xml = doc.documentElement().firstChildElement(QStringLiteral("producer")); if (!xml.isNull()) { xml.setAttribute(QStringLiteral("thumbnailOnly"), 1); emit createThumb(xml, ctrl->clipId(), 150); } } } }
/************************************************************************* Initialises the Scrollbar object ready for use. *************************************************************************/ void Scrollbar::initialise(void) { // Set up thumb d_thumb = createThumb(getName() + "__auto_thumb__"); addChildWindow(d_thumb); d_thumb->subscribeEvent(Thumb::EventThumbPositionChanged, Event::Subscriber(&CEGUI::Scrollbar::handleThumbMoved, this)); d_thumb->subscribeEvent(Thumb::EventThumbTrackStarted, Event::Subscriber(&CEGUI::Scrollbar::handleThumbTrackStarted, this)); d_thumb->subscribeEvent(Thumb::EventThumbTrackEnded, Event::Subscriber(&CEGUI::Scrollbar::handleThumbTrackEnded, this)); // set up Increase button d_increase = createIncreaseButton(getName() + "__auto_incbtn__"); addChildWindow(d_increase); d_increase->subscribeEvent(PushButton::EventMouseButtonDown, Event::Subscriber(&CEGUI::Scrollbar::handleIncreaseClicked, this)); // set up Decrease button d_decrease = createDecreaseButton(getName() + "__auto_decbtn__"); addChildWindow(d_decrease); d_decrease->subscribeEvent(PushButton::EventMouseButtonDown, Event::Subscriber(&CEGUI::Scrollbar::handleDecreaseClicked, this)); // do initial layout performChildWindowLayout(); }
void KImGalleryPlugin::createBody(QTextStream& stream, const QString& sourceDirName, const QStringList& subDirList, const QDir& imageDir, const KURL& url, const QString& imageFormat) { int numOfImages = imageDir.count(); const QString imgGalleryDir = url.directory(); const QString today(KGlobal::locale()->formatDate(QDate::currentDate())); stream << "<body>\n<h1>" << QStyleSheet::escape(m_configDlg->getTitle()) << "</h1><p>" << endl; stream << i18n("<i>Number of images</i>: %1").arg(numOfImages) << "<br/>" << endl; stream << i18n("<i>Created on</i>: %1").arg(today) << "</p>" << endl; stream << "<hr/>" << endl; if (m_recurseSubDirectories && subDirList.count() > 2) { //subDirList.count() is always >= 2 because of the "." and ".." directories stream << i18n("<i>Subfolders</i>:") << "<br>" << endl; for (QStringList::ConstIterator it = subDirList.begin(); it != subDirList.end(); it++) { if (*it == "." || *it == "..") continue; //disregard the "." and ".." directories stream << "<a href=\"" << *it << "/" << url.fileName() << "\">" << *it << "</a><br>" << endl; } stream << "<hr/>" << endl; } stream << "<table>" << endl; //table with images int imgIndex; QFileInfo imginfo; QPixmap imgProp; for (imgIndex = 0; !m_cancelled && (imgIndex < numOfImages);) { stream << "<tr>" << endl; for (int col=0; !m_cancelled && (col < m_imagesPerRow) && (imgIndex < numOfImages); col++) { const QString imgName = imageDir[imgIndex]; if (m_copyFiles) { stream << "<td align='center'>\n<a href=\"images/" << imgName << "\">"; } else { stream << "<td align='center'>\n<a href=\"" << imgName << "\">"; } if (createThumb(imgName, sourceDirName, imgGalleryDir, imageFormat)) { const QString imgPath("thumbs/" + imgName + extension(imageFormat)); stream << "<img src=\"" << imgPath << "\" width=\"" << m_imgWidth << "\" "; stream << "height=\"" << m_imgHeight << "\" alt=\"" << imgPath << "\"/>"; m_progressDlg->setLabelText( i18n("Created thumbnail for: \n%1").arg(imgName) ); } else { kdDebug(90170) << "Creating thumbnail for " << imgName << " failed" << endl; m_progressDlg->setLabelText( i18n("Creating thumbnail for: \n%1\n failed").arg(imgName) ); } stream << "</a>" << endl; if (m_configDlg->printImageName()) { stream << "<div>" << imgName << "</div>" << endl; } if (m_configDlg->printImageProperty()) { imgProp.load( imageDir.absFilePath(imgName,true) ); stream << "<div>" << imgProp.width() << " x " << imgProp.height() << "</div>" << endl; } if (m_configDlg->printImageSize()) { imginfo.setFile( imageDir, imgName ); stream << "<div>(" << (imginfo.size() / 1024) << " " << i18n("KB") << ")" << "</div>" << endl; } if (m_useCommentFile) { QString imgComment = (*m_commentMap)[imgName]; stream << "<div>" << QStyleSheet::escape(imgComment) << "</div>" << endl; } stream << "</td>" << endl; m_progressDlg->setTotalSteps( numOfImages ); m_progressDlg->setProgress( imgIndex ); kapp->processEvents(); imgIndex++; } stream << "</tr>" << endl; } //close the HTML stream << "</table>\n</body>\n</html>" << endl; }