mirror of
https://invent.kde.org/graphics/okular
synced 2024-09-12 20:51:17 +00:00
[generators/*] Replace deprecated foreach with range-for
This commit is contained in:
parent
c549acaab0
commit
54494cc3d4
|
@ -80,7 +80,7 @@ bool CHMGenerator::loadDocument( const QString & fileName, QVector< Okular::Page
|
||||||
QMap<QString, int> tmpPageList;
|
QMap<QString, int> tmpPageList;
|
||||||
int pageNum = 0;
|
int pageNum = 0;
|
||||||
|
|
||||||
foreach(const EBookTocEntry &e, topics)
|
for (const EBookTocEntry &e : qAsConst(topics))
|
||||||
{
|
{
|
||||||
QDomElement item = m_docSyn.createElement(e.name);
|
QDomElement item = m_docSyn.createElement(e.name);
|
||||||
if (!e.url.isEmpty())
|
if (!e.url.isEmpty())
|
||||||
|
@ -107,7 +107,7 @@ bool CHMGenerator::loadDocument( const QString & fileName, QVector< Okular::Page
|
||||||
pageList.prepend(home);
|
pageList.prepend(home);
|
||||||
m_pageUrl.resize(pageNum);
|
m_pageUrl.resize(pageNum);
|
||||||
|
|
||||||
foreach (const QUrl &qurl, pageList)
|
for (const QUrl &qurl : qAsConst(pageList))
|
||||||
{
|
{
|
||||||
QString url = qurl.toString();
|
QString url = qurl.toString();
|
||||||
const QString urlLower = url.toLower();
|
const QString urlLower = url.toLower();
|
||||||
|
|
|
@ -122,7 +122,7 @@ bool EBook_CHM::getTableOfContents( QList<EBookTocEntry> &toc ) const
|
||||||
|
|
||||||
// Fill up the real toc
|
// Fill up the real toc
|
||||||
toc.reserve( parsed.size() );
|
toc.reserve( parsed.size() );
|
||||||
Q_FOREACH( const ParsedEntry& e, parsed )
|
for ( const ParsedEntry &e : qAsConst(parsed) )
|
||||||
{
|
{
|
||||||
if ( root_offset == -1 )
|
if ( root_offset == -1 )
|
||||||
root_offset = e.indent;
|
root_offset = e.indent;
|
||||||
|
@ -157,7 +157,8 @@ bool EBook_CHM::getIndex(QList<EBookIndexEntry> &index) const
|
||||||
index.reserve( parsed.size() );
|
index.reserve( parsed.size() );
|
||||||
|
|
||||||
// Find the index root offset
|
// Find the index root offset
|
||||||
Q_FOREACH( const ParsedEntry& e, parsed )
|
const QList< ParsedEntry > &parsedList = parsed;
|
||||||
|
for ( const ParsedEntry &e : parsedList )
|
||||||
{
|
{
|
||||||
if ( e.urls.empty() )
|
if ( e.urls.empty() )
|
||||||
continue;
|
continue;
|
||||||
|
@ -166,7 +167,7 @@ bool EBook_CHM::getIndex(QList<EBookIndexEntry> &index) const
|
||||||
}
|
}
|
||||||
|
|
||||||
// And apply the index
|
// And apply the index
|
||||||
Q_FOREACH( const ParsedEntry& e, parsed )
|
for( const ParsedEntry &e : parsedList )
|
||||||
{
|
{
|
||||||
if ( e.urls.empty() )
|
if ( e.urls.empty() )
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -232,13 +232,13 @@ bool EBook_EPUB::parseBookinfo()
|
||||||
m_title = content_parser.metadata[ "title" ];
|
m_title = content_parser.metadata[ "title" ];
|
||||||
|
|
||||||
// Move the manifest entries into the list
|
// Move the manifest entries into the list
|
||||||
Q_FOREACH( QString f, content_parser.manifest.values() )
|
for ( const QString &f : qAsConst(content_parser.manifest) )
|
||||||
m_ebookManifest.push_back( pathToUrl( f ) );
|
m_ebookManifest.push_back( pathToUrl( f ) );
|
||||||
|
|
||||||
// Copy the manifest information and fill up the other maps if we have it
|
// Copy the manifest information and fill up the other maps if we have it
|
||||||
if ( !toc_parser.entries.isEmpty() )
|
if ( !toc_parser.entries.isEmpty() )
|
||||||
{
|
{
|
||||||
Q_FOREACH( EBookTocEntry e, toc_parser.entries )
|
for( EBookTocEntry e : qAsConst(toc_parser.entries) )
|
||||||
{
|
{
|
||||||
// Add into url-title map
|
// Add into url-title map
|
||||||
m_urlTitleMap[ e.url ] = e.name;
|
m_urlTitleMap[ e.url ] = e.name;
|
||||||
|
@ -247,14 +247,13 @@ bool EBook_EPUB::parseBookinfo()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Copy them from spline
|
// Copy them from spine
|
||||||
Q_FOREACH( QString u, content_parser.spine )
|
for( QString url : qAsConst(content_parser.spine) )
|
||||||
{
|
{
|
||||||
EBookTocEntry e;
|
EBookTocEntry e;
|
||||||
QString url = u;
|
|
||||||
|
|
||||||
if ( content_parser.manifest.contains( u ) )
|
if ( content_parser.manifest.contains( url ) )
|
||||||
url = content_parser.manifest[ u ];
|
url = content_parser.manifest[ url ];
|
||||||
|
|
||||||
e.name = url;
|
e.name = url;
|
||||||
e.url= pathToUrl( url );
|
e.url= pathToUrl( url );
|
||||||
|
|
|
@ -35,12 +35,13 @@ using namespace ComicBook;
|
||||||
|
|
||||||
static void imagesInArchive( const QString &prefix, const KArchiveDirectory* dir, QStringList *entries )
|
static void imagesInArchive( const QString &prefix, const KArchiveDirectory* dir, QStringList *entries )
|
||||||
{
|
{
|
||||||
Q_FOREACH ( const QString &entry, dir->entries() ) {
|
const QStringList entryList = dir->entries();
|
||||||
const KArchiveEntry *e = dir->entry( entry );
|
for ( const QString &file : entryList ) {
|
||||||
|
const KArchiveEntry *e = dir->entry( file );
|
||||||
if ( e->isDirectory() ) {
|
if ( e->isDirectory() ) {
|
||||||
imagesInArchive( prefix + entry + QLatin1Char('/'), static_cast<const KArchiveDirectory*>( e ), entries );
|
imagesInArchive( prefix + file + QLatin1Char('/'), static_cast<const KArchiveDirectory*>( e ), entries );
|
||||||
} else if ( e->isFile() ) {
|
} else if ( e->isFile() ) {
|
||||||
entries->append( prefix + entry );
|
entries->append( prefix + file );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,7 +185,7 @@ void Document::pages( QVector<Okular::Page*> * pagesVector )
|
||||||
pagesVector->clear();
|
pagesVector->clear();
|
||||||
pagesVector->resize( mEntries.size() );
|
pagesVector->resize( mEntries.size() );
|
||||||
QImageReader reader;
|
QImageReader reader;
|
||||||
foreach(const QString &file, mEntries) {
|
for (const QString &file : qAsConst(mEntries)) {
|
||||||
if ( mArchive ) {
|
if ( mArchive ) {
|
||||||
const KArchiveFile *entry = static_cast<const KArchiveFile*>( mArchiveDir->entry( file ) );
|
const KArchiveFile *entry = static_cast<const KArchiveFile*>( mArchiveDir->entry( file ) );
|
||||||
if ( entry ) {
|
if ( entry ) {
|
||||||
|
|
|
@ -160,7 +160,7 @@ QStringList Unrar::list()
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList newList;
|
QStringList newList;
|
||||||
Q_FOREACH ( const QString &f, listFiles ) {
|
for ( const QString &f : qAsConst(listFiles) ) {
|
||||||
// Extract all the files to mTempDir regardless of their path inside the archive
|
// Extract all the files to mTempDir regardless of their path inside the archive
|
||||||
// This will break if ever an arvhice with two files with the same name in different subfolders
|
// This will break if ever an arvhice with two files with the same name in different subfolders
|
||||||
QFileInfo fi( f );
|
QFileInfo fi( f );
|
||||||
|
|
|
@ -77,7 +77,7 @@ QStringList FreeUnrarFlavour::processListing( const QStringList &data )
|
||||||
QRegExp re( QStringLiteral("^ ([^/]+/([^\\s]+))$") );
|
QRegExp re( QStringLiteral("^ ([^/]+/([^\\s]+))$") );
|
||||||
|
|
||||||
QStringList newdata;
|
QStringList newdata;
|
||||||
foreach ( const QString &line, data )
|
for ( const QString &line : data )
|
||||||
{
|
{
|
||||||
if ( re.exactMatch( line ) )
|
if ( re.exactMatch( line ) )
|
||||||
newdata.append( re.cap( 1 ) );
|
newdata.append( re.cap( 1 ) );
|
||||||
|
|
|
@ -1057,7 +1057,7 @@ bool KDjVu::exportAsPostScript( QFile* file, const QList<int>& pageList ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
QString pl;
|
QString pl;
|
||||||
foreach ( int p, pageList )
|
for ( const int p : pageList )
|
||||||
{
|
{
|
||||||
if ( !pl.isEmpty() )
|
if ( !pl.isEmpty() )
|
||||||
pl += QLatin1String( "," );
|
pl += QLatin1String( "," );
|
||||||
|
|
|
@ -366,7 +366,7 @@ void dviRenderer::prescan_ParsePSSpecial(const QString& cp)
|
||||||
if (cp.contains(QStringLiteral("/Dest")) && cp.contains(QStringLiteral("/Title"))) {
|
if (cp.contains(QStringLiteral("/Dest")) && cp.contains(QStringLiteral("/Title"))) {
|
||||||
const QString childrenNumberAndMoreStuff = cp.section(QLatin1Char('-'), 1, 1); // Contains from the - symbol to the end of cp, effectively containing the number of children and some stuff after it
|
const QString childrenNumberAndMoreStuff = cp.section(QLatin1Char('-'), 1, 1); // Contains from the - symbol to the end of cp, effectively containing the number of children and some stuff after it
|
||||||
int indexOfFirstNonDigit = 0;
|
int indexOfFirstNonDigit = 0;
|
||||||
foreach(const QChar &c, childrenNumberAndMoreStuff) {
|
for (const QChar &c : childrenNumberAndMoreStuff) {
|
||||||
if (c.isDigit()) ++indexOfFirstNonDigit;
|
if (c.isDigit()) ++indexOfFirstNonDigit;
|
||||||
else break;
|
else break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ QLinkedList<Okular::ObjectRect*> DviGenerator::generateDviLinks( const dviPageIn
|
||||||
|
|
||||||
int pageWidth = pageInfo->width, pageHeight = pageInfo->height;
|
int pageWidth = pageInfo->width, pageHeight = pageInfo->height;
|
||||||
|
|
||||||
foreach( const Hyperlink &dviLink, pageInfo->hyperLinkList )
|
for ( const Hyperlink &dviLink : qAsConst(pageInfo->hyperLinkList) )
|
||||||
{
|
{
|
||||||
QRect boxArea = dviLink.box;
|
QRect boxArea = dviLink.box;
|
||||||
double nl = (double)boxArea.left() / pageWidth,
|
double nl = (double)boxArea.left() / pageWidth,
|
||||||
|
@ -391,9 +391,8 @@ Okular::FontInfo::List DviGenerator::fontsForPage( int page )
|
||||||
if ( m_dviRenderer && m_dviRenderer->dviFile &&
|
if ( m_dviRenderer && m_dviRenderer->dviFile &&
|
||||||
m_dviRenderer->dviFile->font_pool )
|
m_dviRenderer->dviFile->font_pool )
|
||||||
{
|
{
|
||||||
QList<TeXFontDefinition*> fonts = m_dviRenderer->dviFile->font_pool->fontList;
|
const QList<TeXFontDefinition *> fonts = m_dviRenderer->dviFile->font_pool->fontList;
|
||||||
|
for (const TeXFontDefinition *font : fonts)
|
||||||
foreach (const TeXFontDefinition* font, fonts)
|
|
||||||
{
|
{
|
||||||
Okular::FontInfo of;
|
Okular::FontInfo of;
|
||||||
QString name;
|
QString name;
|
||||||
|
@ -506,7 +505,7 @@ void DviGenerator::loadPages( QVector< Okular::Page * > &pagesVector )
|
||||||
// filling the pages with the source references rects
|
// filling the pages with the source references rects
|
||||||
const QVector<DVI_SourceFileAnchor>& sourceAnchors = m_dviRenderer->sourceAnchors();
|
const QVector<DVI_SourceFileAnchor>& sourceAnchors = m_dviRenderer->sourceAnchors();
|
||||||
QVector< QLinkedList< Okular::SourceRefObjectRect * > > refRects( numofpages );
|
QVector< QLinkedList< Okular::SourceRefObjectRect * > > refRects( numofpages );
|
||||||
foreach ( const DVI_SourceFileAnchor& sfa, sourceAnchors )
|
for ( const DVI_SourceFileAnchor &sfa : sourceAnchors )
|
||||||
{
|
{
|
||||||
if ( sfa.page < 1 || (int)sfa.page > numofpages )
|
if ( sfa.page < 1 || (int)sfa.page > numofpages )
|
||||||
continue;
|
continue;
|
||||||
|
@ -527,14 +526,14 @@ bool DviGenerator::print( QPrinter& printer )
|
||||||
if ( !tf.open() )
|
if ( !tf.open() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
QList<int> pageList = Okular::FilePrinter::pageList( printer,
|
const QList<int> pageList = Okular::FilePrinter::pageList( printer,
|
||||||
m_dviRenderer->totalPages(),
|
m_dviRenderer->totalPages(),
|
||||||
document()->currentPage() + 1,
|
document()->currentPage() + 1,
|
||||||
document()->bookmarkedPageList() );
|
document()->bookmarkedPageList() );
|
||||||
QString pages;
|
QString pages;
|
||||||
QStringList printOptions;
|
QStringList printOptions;
|
||||||
// List of pages to print.
|
// List of pages to print.
|
||||||
foreach ( int p, pageList )
|
for ( const int p : pageList )
|
||||||
{
|
{
|
||||||
pages += QStringLiteral(",%1").arg(p);
|
pages += QStringLiteral(",%1").arg(p);
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,7 +250,7 @@ QTextDocument* Converter::convert( const QString &fileName )
|
||||||
newDoc.setContent(QStringLiteral("<img src=\"%1\" height=\"%2\" width=\"%3\" />").arg(lnk).arg(ht).arg(wd));
|
newDoc.setContent(QStringLiteral("<img src=\"%1\" height=\"%2\" width=\"%3\" />").arg(lnk).arg(ht).arg(wd));
|
||||||
imgNodes.append(newDoc.documentElement());
|
imgNodes.append(newDoc.documentElement());
|
||||||
}
|
}
|
||||||
foreach (const QDomNode& nd, imgNodes) {
|
for (const QDomNode &nd : qAsConst(imgNodes)) {
|
||||||
svgs.at(i).parentNode().replaceChild(nd,svgs.at(i));
|
svgs.at(i).parentNode().replaceChild(nd,svgs.at(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,9 +79,10 @@ QTextDocument* Converter::convert( const QString &fileName )
|
||||||
//link
|
//link
|
||||||
if (!format.anchorHref().isEmpty()) links[format.anchorHref()]=
|
if (!format.anchorHref().isEmpty()) links[format.anchorHref()]=
|
||||||
QPair<int,int>(frag.position(), frag.position()+frag.length());
|
QPair<int,int>(frag.position(), frag.position()+frag.length());
|
||||||
if (!format.anchorNames().isEmpty()) {
|
const QStringList anchors = format.anchorNames();
|
||||||
|
if (!anchors.isEmpty()) {
|
||||||
// link targets
|
// link targets
|
||||||
Q_FOREACH(const QString& name, format.anchorNames())
|
for (const QString &name : anchors)
|
||||||
targets[QLatin1Char('#')+name]=it;
|
targets[QLatin1Char('#')+name]=it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,8 +193,11 @@ void PopplerAnnotationProxy::notifyModification( const Okular::Annotation *okl_a
|
||||||
const Okular::LineAnnotation * okl_lineann = static_cast<const Okular::LineAnnotation*>(okl_ann);
|
const Okular::LineAnnotation * okl_lineann = static_cast<const Okular::LineAnnotation*>(okl_ann);
|
||||||
Poppler::LineAnnotation * ppl_lineann = static_cast<Poppler::LineAnnotation*>(ppl_ann);
|
Poppler::LineAnnotation * ppl_lineann = static_cast<Poppler::LineAnnotation*>(ppl_ann);
|
||||||
QLinkedList<QPointF> points;
|
QLinkedList<QPointF> points;
|
||||||
foreach ( const Okular::NormalizedPoint &p, okl_lineann->linePoints() )
|
const QLinkedList<Okular::NormalizedPoint> annotPoints = okl_lineann->linePoints();
|
||||||
|
for ( const Okular::NormalizedPoint &p : annotPoints )
|
||||||
|
{
|
||||||
points.append(normPointToPointF( p ));
|
points.append(normPointToPointF( p ));
|
||||||
|
}
|
||||||
ppl_lineann->setLinePoints( points );
|
ppl_lineann->setLinePoints( points );
|
||||||
ppl_lineann->setLineStartStyle( (Poppler::LineAnnotation::TermStyle)okl_lineann->lineStartStyle() );
|
ppl_lineann->setLineStartStyle( (Poppler::LineAnnotation::TermStyle)okl_lineann->lineStartStyle() );
|
||||||
ppl_lineann->setLineEndStyle( (Poppler::LineAnnotation::TermStyle)okl_lineann->lineEndStyle() );
|
ppl_lineann->setLineEndStyle( (Poppler::LineAnnotation::TermStyle)okl_lineann->lineEndStyle() );
|
||||||
|
@ -233,11 +236,14 @@ void PopplerAnnotationProxy::notifyModification( const Okular::Annotation *okl_a
|
||||||
const Okular::InkAnnotation * okl_inkann = static_cast<const Okular::InkAnnotation*>(okl_ann);
|
const Okular::InkAnnotation * okl_inkann = static_cast<const Okular::InkAnnotation*>(okl_ann);
|
||||||
Poppler::InkAnnotation * ppl_inkann = static_cast<Poppler::InkAnnotation*>(ppl_ann);
|
Poppler::InkAnnotation * ppl_inkann = static_cast<Poppler::InkAnnotation*>(ppl_ann);
|
||||||
QList< QLinkedList<QPointF> > paths;
|
QList< QLinkedList<QPointF> > paths;
|
||||||
foreach ( const QLinkedList<Okular::NormalizedPoint> &path, okl_inkann->inkPaths() )
|
const QList< QLinkedList<Okular::NormalizedPoint> > inkPathsList = okl_inkann->inkPaths();
|
||||||
|
for ( const QLinkedList<Okular::NormalizedPoint> &path : inkPathsList )
|
||||||
{
|
{
|
||||||
QLinkedList<QPointF> points;
|
QLinkedList<QPointF> points;
|
||||||
foreach ( const Okular::NormalizedPoint &p, path )
|
for ( const Okular::NormalizedPoint &p : path )
|
||||||
|
{
|
||||||
points.append(normPointToPointF( p ));
|
points.append(normPointToPointF( p ));
|
||||||
|
}
|
||||||
paths.append( points );
|
paths.append( points );
|
||||||
}
|
}
|
||||||
ppl_inkann->setInkPaths( paths );
|
ppl_inkann->setInkPaths( paths );
|
||||||
|
|
|
@ -289,7 +289,7 @@ QPair<Okular::Movie*, Okular::EmbeddedFile*> createMovieFromPopplerRichMedia( co
|
||||||
bool playbackLoops = false;
|
bool playbackLoops = false;
|
||||||
|
|
||||||
const QStringList flashVars = params->flashVars().split( QLatin1Char( '&' ) );
|
const QStringList flashVars = params->flashVars().split( QLatin1Char( '&' ) );
|
||||||
foreach ( const QString & flashVar, flashVars ) {
|
for ( const QString &flashVar : flashVars ) {
|
||||||
const int pos = flashVar.indexOf( QLatin1Char( '=' ) );
|
const int pos = flashVar.indexOf( QLatin1Char( '=' ) );
|
||||||
if ( pos == -1 )
|
if ( pos == -1 )
|
||||||
continue;
|
continue;
|
||||||
|
@ -311,7 +311,7 @@ QPair<Okular::Movie*, Okular::EmbeddedFile*> createMovieFromPopplerRichMedia( co
|
||||||
return emptyResult;
|
return emptyResult;
|
||||||
|
|
||||||
Poppler::RichMediaAnnotation::Asset *matchingAsset = 0;
|
Poppler::RichMediaAnnotation::Asset *matchingAsset = 0;
|
||||||
foreach ( Poppler::RichMediaAnnotation::Asset *asset, assets ) {
|
for ( Poppler::RichMediaAnnotation::Asset *asset : assets ) {
|
||||||
if ( asset->name() == sourceId ) {
|
if ( asset->name() == sourceId ) {
|
||||||
matchingAsset = asset;
|
matchingAsset = asset;
|
||||||
break;
|
break;
|
||||||
|
@ -547,7 +547,7 @@ Okular::Action* createLinkFromPopplerLink(const Poppler::Link *popplerLink, bool
|
||||||
static QLinkedList<Okular::ObjectRect*> generateLinks( const QList<Poppler::Link*> &popplerLinks )
|
static QLinkedList<Okular::ObjectRect*> generateLinks( const QList<Poppler::Link*> &popplerLinks )
|
||||||
{
|
{
|
||||||
QLinkedList<Okular::ObjectRect*> links;
|
QLinkedList<Okular::ObjectRect*> links;
|
||||||
foreach(const Poppler::Link *popplerLink, popplerLinks)
|
for (const Poppler::Link *popplerLink : popplerLinks)
|
||||||
{
|
{
|
||||||
QRectF linkArea = popplerLink->linkArea();
|
QRectF linkArea = popplerLink->linkArea();
|
||||||
double nl = linkArea.left(),
|
double nl = linkArea.left(),
|
||||||
|
@ -939,7 +939,7 @@ Okular::FontInfo::List PDFGenerator::fontsForPage( int page )
|
||||||
}
|
}
|
||||||
userMutex()->unlock();
|
userMutex()->unlock();
|
||||||
|
|
||||||
foreach (const Poppler::FontInfo &font, fonts)
|
for (const Poppler::FontInfo &font : qAsConst(fonts))
|
||||||
{
|
{
|
||||||
Okular::FontInfo of;
|
Okular::FontInfo of;
|
||||||
of.setName( font.name() );
|
of.setName( font.name() );
|
||||||
|
@ -969,7 +969,7 @@ const QList<Okular::EmbeddedFile*> *PDFGenerator::embeddedFiles() const
|
||||||
{
|
{
|
||||||
userMutex()->lock();
|
userMutex()->lock();
|
||||||
const QList<Poppler::EmbeddedFile*> &popplerFiles = pdfdoc->embeddedFiles();
|
const QList<Poppler::EmbeddedFile*> &popplerFiles = pdfdoc->embeddedFiles();
|
||||||
foreach(Poppler::EmbeddedFile* pef, popplerFiles)
|
for (Poppler::EmbeddedFile *pef : popplerFiles)
|
||||||
{
|
{
|
||||||
docEmbeddedFiles.append(new PDFEmbeddedFile(pef));
|
docEmbeddedFiles.append(new PDFEmbeddedFile(pef));
|
||||||
}
|
}
|
||||||
|
@ -1247,7 +1247,8 @@ void PDFGenerator::resolveMediaLinkReferences( Okular::Page *page )
|
||||||
resolveMediaLinkReference( const_cast<Okular::Action*>( page->pageAction( Okular::Page::Opening ) ) );
|
resolveMediaLinkReference( const_cast<Okular::Action*>( page->pageAction( Okular::Page::Opening ) ) );
|
||||||
resolveMediaLinkReference( const_cast<Okular::Action*>( page->pageAction( Okular::Page::Closing ) ) );
|
resolveMediaLinkReference( const_cast<Okular::Action*>( page->pageAction( Okular::Page::Closing ) ) );
|
||||||
|
|
||||||
foreach ( Okular::Annotation *annotation, page->annotations() )
|
const QLinkedList< Okular::Annotation* > annotations = page->annotations();
|
||||||
|
for ( Okular::Annotation *annotation : annotations )
|
||||||
{
|
{
|
||||||
if ( annotation->subType() == Okular::Annotation::AScreen )
|
if ( annotation->subType() == Okular::Annotation::AScreen )
|
||||||
{
|
{
|
||||||
|
@ -1264,8 +1265,11 @@ void PDFGenerator::resolveMediaLinkReferences( Okular::Page *page )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ( Okular::FormField *field, page->formFields() )
|
const QLinkedList< Okular::FormField * > fields = page->formFields();
|
||||||
|
for ( Okular::FormField *field : fields )
|
||||||
|
{
|
||||||
resolveMediaLinkReference( field->activationAction() );
|
resolveMediaLinkReference( field->activationAction() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_POPPLER_0_63
|
#ifdef HAVE_POPPLER_0_63
|
||||||
|
@ -1588,7 +1592,8 @@ QVariant PDFGenerator::metaData( const QString & key, const QVariant & option )
|
||||||
uint numPages = doc->pages();
|
uint numPages = doc->pages();
|
||||||
for ( uint i = 0; i < numPages; i++ )
|
for ( uint i = 0; i < numPages; i++ )
|
||||||
{
|
{
|
||||||
foreach ( Okular::FormField *f, doc->page( i )->formFields() )
|
const QLinkedList<Okular::FormField *> formFields = doc->page( i )->formFields();
|
||||||
|
for ( const Okular::FormField *f : formFields )
|
||||||
{
|
{
|
||||||
if ( f->type() == Okular::FormField::FormSignature )
|
if ( f->type() == Okular::FormField::FormSignature )
|
||||||
return true;
|
return true;
|
||||||
|
@ -1727,7 +1732,7 @@ Okular::TextPage * PDFGenerator::abstractTextPage(const QList<Poppler::TextBox*>
|
||||||
#endif
|
#endif
|
||||||
QString s;
|
QString s;
|
||||||
bool addChar;
|
bool addChar;
|
||||||
foreach (Poppler::TextBox *word, text)
|
for (const Poppler::TextBox *word : text)
|
||||||
{
|
{
|
||||||
const int qstringCharCount = word->text().length();
|
const int qstringCharCount = word->text().length();
|
||||||
next=word->nextWord();
|
next=word->nextWord();
|
||||||
|
@ -1828,12 +1833,12 @@ void PDFGenerator::addAnnotations( Poppler::Page * popplerPage, Okular::Page * p
|
||||||
<< Poppler::Annotation::AStamp
|
<< Poppler::Annotation::AStamp
|
||||||
<< Poppler::Annotation::ACaret;
|
<< Poppler::Annotation::ACaret;
|
||||||
|
|
||||||
QList<Poppler::Annotation*> popplerAnnotations = popplerPage->annotations( subtypes );
|
const QList<Poppler::Annotation*> popplerAnnotations = popplerPage->annotations( subtypes );
|
||||||
#else
|
#else
|
||||||
QList<Poppler::Annotation*> popplerAnnotations = popplerPage->annotations();
|
const QList<Poppler::Annotation*> popplerAnnotations = popplerPage->annotations();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
foreach(Poppler::Annotation *a, popplerAnnotations)
|
for (Poppler::Annotation *a : popplerAnnotations)
|
||||||
{
|
{
|
||||||
bool doDelete = true;
|
bool doDelete = true;
|
||||||
Okular::Annotation * newann = createAnnotationFromPopplerAnnotation( a, &doDelete );
|
Okular::Annotation * newann = createAnnotationFromPopplerAnnotation( a, &doDelete );
|
||||||
|
@ -1964,9 +1969,9 @@ void PDFGenerator::addTransition( Poppler::Page * pdfPage, Okular::Page * page )
|
||||||
|
|
||||||
void PDFGenerator::addFormFields( Poppler::Page * popplerPage, Okular::Page * page )
|
void PDFGenerator::addFormFields( Poppler::Page * popplerPage, Okular::Page * page )
|
||||||
{
|
{
|
||||||
QList<Poppler::FormField*> popplerFormFields = popplerPage->formFields();
|
const QList<Poppler::FormField*> popplerFormFields = popplerPage->formFields();
|
||||||
QLinkedList<Okular::FormField*> okularFormFields;
|
QLinkedList<Okular::FormField*> okularFormFields;
|
||||||
foreach( Poppler::FormField *f, popplerFormFields )
|
for ( Poppler::FormField *f : popplerFormFields )
|
||||||
{
|
{
|
||||||
Okular::FormField * of = nullptr;
|
Okular::FormField * of = nullptr;
|
||||||
switch ( f->type() )
|
switch ( f->type() )
|
||||||
|
|
|
@ -508,7 +508,7 @@ static QByteArray readFileOrDirectoryParts( const KArchiveEntry *entry, QString
|
||||||
const KArchiveDirectory* relDir = static_cast<const KArchiveDirectory *>( entry );
|
const KArchiveDirectory* relDir = static_cast<const KArchiveDirectory *>( entry );
|
||||||
QStringList entries = relDir->entries();
|
QStringList entries = relDir->entries();
|
||||||
std::sort(entries.begin(), entries.end());
|
std::sort(entries.begin(), entries.end());
|
||||||
Q_FOREACH ( const QString &entry, entries ) {
|
for ( const QString &entry : qAsConst(entries) ) {
|
||||||
const KArchiveEntry* relSubEntry = relDir->entry( entry );
|
const KArchiveEntry* relSubEntry = relDir->entry( entry );
|
||||||
if ( !relSubEntry->isFile() )
|
if ( !relSubEntry->isFile() )
|
||||||
continue;
|
continue;
|
||||||
|
@ -553,7 +553,7 @@ static const KArchiveEntry* loadEntry( KZip *archive, const QString &fileName, Q
|
||||||
const KArchiveDirectory* relDir = static_cast< const KArchiveDirectory * >( newEntry );
|
const KArchiveDirectory* relDir = static_cast< const KArchiveDirectory * >( newEntry );
|
||||||
QStringList relEntries = relDir->entries();
|
QStringList relEntries = relDir->entries();
|
||||||
std::sort(relEntries.begin(), relEntries.end());
|
std::sort(relEntries.begin(), relEntries.end());
|
||||||
Q_FOREACH ( const QString &relEntry, relEntries ) {
|
for ( const QString &relEntry : qAsConst(relEntries) ) {
|
||||||
if ( relEntry.compare( entryName, Qt::CaseInsensitive ) == 0 ) {
|
if ( relEntry.compare( entryName, Qt::CaseInsensitive ) == 0 ) {
|
||||||
return relDir->entry( relEntry );
|
return relDir->entry( relEntry );
|
||||||
}
|
}
|
||||||
|
@ -606,7 +606,7 @@ static bool xpsGradientLessThan( const XpsGradient &g1, const XpsGradient &g2 )
|
||||||
static int xpsGradientWithOffset( const QList<XpsGradient> &gradients, double offset )
|
static int xpsGradientWithOffset( const QList<XpsGradient> &gradients, double offset )
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
Q_FOREACH ( const XpsGradient &grad, gradients ) {
|
for ( const XpsGradient &grad : gradients ) {
|
||||||
if ( grad.offset == offset ) {
|
if ( grad.offset == offset ) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -686,7 +686,7 @@ static void preprocessXpsGradients( QList<XpsGradient> &gradients )
|
||||||
|
|
||||||
static void addXpsGradientsToQGradient( const QList<XpsGradient> &gradients, QGradient *qgrad )
|
static void addXpsGradientsToQGradient( const QList<XpsGradient> &gradients, QGradient *qgrad )
|
||||||
{
|
{
|
||||||
Q_FOREACH ( const XpsGradient &grad, gradients ) {
|
for ( const XpsGradient &grad : gradients ) {
|
||||||
qgrad->setColorAt( grad.offset, grad.color );
|
qgrad->setColorAt( grad.offset, grad.color );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1121,7 +1121,7 @@ void XpsHandler::processPath( XpsRenderNode &node )
|
||||||
m_painter->setWorldTransform( pathdata->transform, true );
|
m_painter->setWorldTransform( pathdata->transform, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_FOREACH ( XpsPathFigure *figure, pathdata->paths ) {
|
for ( const XpsPathFigure *figure : qAsConst(pathdata->paths) ) {
|
||||||
m_painter->setBrush( figure->isFilled ? brush : QBrush() );
|
m_painter->setBrush( figure->isFilled ? brush : QBrush() );
|
||||||
m_painter->drawPath( figure->path );
|
m_painter->drawPath( figure->path );
|
||||||
}
|
}
|
||||||
|
@ -1144,7 +1144,7 @@ void XpsHandler::processPathGeometry( XpsRenderNode &node )
|
||||||
{
|
{
|
||||||
XpsPathGeometry * geom = new XpsPathGeometry();
|
XpsPathGeometry * geom = new XpsPathGeometry();
|
||||||
|
|
||||||
Q_FOREACH ( const XpsRenderNode &child, node.children ) {
|
for ( const XpsRenderNode &child : qAsConst(node.children) ) {
|
||||||
if ( child.data.canConvert<XpsPathFigure *>() ) {
|
if ( child.data.canConvert<XpsPathFigure *>() ) {
|
||||||
XpsPathFigure *figure = child.data.value<XpsPathFigure *>();
|
XpsPathFigure *figure = child.data.value<XpsPathFigure *>();
|
||||||
geom->paths.append( figure );
|
geom->paths.append( figure );
|
||||||
|
@ -1194,7 +1194,7 @@ void XpsHandler::processPathFigure( XpsRenderNode &node )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_FOREACH ( const XpsRenderNode &child, node.children ) {
|
for ( const XpsRenderNode &child : qAsConst(node.children) ) {
|
||||||
bool isStroked = true;
|
bool isStroked = true;
|
||||||
att = node.attributes.value( QStringLiteral("IsStroked") );
|
att = node.attributes.value( QStringLiteral("IsStroked") );
|
||||||
if ( !att.isEmpty() ) {
|
if ( !att.isEmpty() ) {
|
||||||
|
@ -1209,7 +1209,7 @@ void XpsHandler::processPathFigure( XpsRenderNode &node )
|
||||||
att = child.attributes.value( QStringLiteral("Points") );
|
att = child.attributes.value( QStringLiteral("Points") );
|
||||||
if ( !att.isEmpty() ) {
|
if ( !att.isEmpty() ) {
|
||||||
const QStringList points = att.split( QLatin1Char( ' ' ), QString::SkipEmptyParts );
|
const QStringList points = att.split( QLatin1Char( ' ' ), QString::SkipEmptyParts );
|
||||||
Q_FOREACH ( const QString &p, points ) {
|
for ( const QString &p : points ) {
|
||||||
QPointF point = getPointFromString( p );
|
QPointF point = getPointFromString( p );
|
||||||
path.lineTo( point );
|
path.lineTo( point );
|
||||||
}
|
}
|
||||||
|
@ -1345,7 +1345,7 @@ void XpsHandler::processEndElement( XpsRenderNode &node )
|
||||||
}
|
}
|
||||||
} else if (node.name == QLatin1String("LinearGradientBrush.GradientStops")) {
|
} else if (node.name == QLatin1String("LinearGradientBrush.GradientStops")) {
|
||||||
QList<XpsGradient> gradients;
|
QList<XpsGradient> gradients;
|
||||||
Q_FOREACH ( const XpsRenderNode &child, node.children ) {
|
for ( const XpsRenderNode &child : qAsConst(node.children) ) {
|
||||||
double offset = child.attributes.value( QStringLiteral("Offset") ).toDouble();
|
double offset = child.attributes.value( QStringLiteral("Offset") ).toDouble();
|
||||||
QColor color = hexToRgba( child.attributes.value( QStringLiteral("Color") ).toLatin1() );
|
QColor color = hexToRgba( child.attributes.value( QStringLiteral("Color") ).toLatin1() );
|
||||||
gradients.append( XpsGradient( offset, color ) );
|
gradients.append( XpsGradient( offset, color ) );
|
||||||
|
@ -1358,7 +1358,7 @@ void XpsHandler::processEndElement( XpsRenderNode &node )
|
||||||
}
|
}
|
||||||
} else if (node.name == QLatin1String("RadialGradientBrush.GradientStops")) {
|
} else if (node.name == QLatin1String("RadialGradientBrush.GradientStops")) {
|
||||||
QList<XpsGradient> gradients;
|
QList<XpsGradient> gradients;
|
||||||
Q_FOREACH ( const XpsRenderNode &child, node.children ) {
|
for ( const XpsRenderNode &child : qAsConst(node.children) ) {
|
||||||
double offset = child.attributes.value( QStringLiteral("Offset") ).toDouble();
|
double offset = child.attributes.value( QStringLiteral("Offset") ).toDouble();
|
||||||
QColor color = hexToRgba( child.attributes.value( QStringLiteral("Color") ).toLatin1() );
|
QColor color = hexToRgba( child.attributes.value( QStringLiteral("Color") ).toLatin1() );
|
||||||
gradients.append( XpsGradient( offset, color ) );
|
gradients.append( XpsGradient( offset, color ) );
|
||||||
|
|
Loading…
Reference in a new issue