summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin T. H. Sandsmark <martin.sandsmark@kde.org>2016-07-11 19:48:17 (GMT)
committerMartin T. H. Sandsmark <martin.sandsmark@kde.org>2016-07-11 19:54:08 (GMT)
commitb512e668e003a35201c0dac01a06a0d98973186f (patch)
tree71aad09cad2885a66a19c3ca59c812499d85da47
parenta1d2d8cac7e1f1b1241b87e6574fcf53a592c8fa (diff)
chm, dvi: Fix build with compiler flags after removing kdelibs4support
After removing kdelibs4support, these flags are enabled: -DQT_USE_FAST_OPERATOR_PLUS -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_URL_CAST_FROM_STRING -DQT_NO_CAST_FROM_BYTEARRAY So wrap naked string and character literals in QStringLiteral, QLatin1Char and QLatin1String as appropriate. To more easily see the changes, use «git show --color-words». Thank $DEITY for vim macros.
-rw-r--r--generators/chm/generator_chm.cpp8
-rw-r--r--generators/chm/kio-msits/msits.cpp4
-rw-r--r--generators/chm/lib/libchmfile.cpp4
-rw-r--r--generators/chm/lib/libchmfile_search.cpp6
-rw-r--r--generators/chm/lib/libchmfileimpl.cpp52
-rw-r--r--generators/chm/lib/libchmfileimpl.h10
-rw-r--r--generators/chm/lib/libchmtextencoding.cpp2
-rw-r--r--generators/chm/lib/libchmurlfactory.h6
-rw-r--r--generators/dvi/TeXFontDefinition.cpp2
-rw-r--r--generators/dvi/TeXFont_PFB.cpp2
-rw-r--r--generators/dvi/dviFile.cpp8
-rw-r--r--generators/dvi/dviRenderer.cpp6
-rw-r--r--generators/dvi/dviRenderer_draw.cpp14
-rw-r--r--generators/dvi/dviRenderer_prescan.cpp54
-rw-r--r--generators/dvi/dviexport.cpp4
-rw-r--r--generators/dvi/dvisourcesplitter.cpp8
-rw-r--r--generators/dvi/fontEncoding.cpp10
-rw-r--r--generators/dvi/fontMap.cpp18
-rw-r--r--generators/dvi/fontpool.cpp18
-rw-r--r--generators/dvi/length.cpp2
-rw-r--r--generators/dvi/pageSize.cpp26
-rw-r--r--generators/dvi/psgs.cpp6
-rw-r--r--generators/dvi/special.cpp52
-rw-r--r--generators/dvi/vf.cpp2
24 files changed, 162 insertions, 162 deletions
diff --git a/generators/chm/generator_chm.cpp b/generators/chm/generator_chm.cpp
index 6b444ee..871df9a 100644
--- a/generators/chm/generator_chm.cpp
+++ b/generators/chm/generator_chm.cpp
@@ -108,7 +108,7 @@ bool CHMGenerator::loadDocument( const QString & fileName, QVector< Okular::Page
if (!urlLower.endsWith(QLatin1String(".html")) && !urlLower.endsWith(QLatin1String(".htm")))
continue;
- int pos = url.indexOf ('#');
+ int pos = url.indexOf (QLatin1Char(('#')));
QString tmpUrl = pos == -1 ? url : url.left(pos);
// url already there, abort insertion
@@ -163,7 +163,7 @@ bool CHMGenerator::doCloseDocument()
void CHMGenerator::preparePageForSyncOperation( int zoom , const QString & url)
{
- QString pAddress= QString("ms-its:" + m_fileName + "::" + url);
+ QString pAddress= QStringLiteral("ms-its:") + m_fileName + QStringLiteral("::") + url;
m_chmUrl = url;
m_syncGen->setZoomFactor(zoom);
m_syncGen->openUrl(QUrl(pAddress));
@@ -258,7 +258,7 @@ void CHMGenerator::generatePixmap( Okular::PixmapRequest * request )
, static_cast<double>(requestHeight)/static_cast<double>(request->page()->height())
) ) * 100;
- QString pAddress= QString("ms-its:" + m_fileName + "::" + url);
+ QString pAddress= QStringLiteral("ms-its:") + m_fileName + QStringLiteral("::") + url;
m_chmUrl = url;
m_syncGen->setZoomFactor(zoom);
m_syncGen->view()->resize(requestWidth,requestHeight);
@@ -425,7 +425,7 @@ QVariant CHMGenerator::metaData( const QString &key, const QVariant &option ) co
{
if ( key == QLatin1String("NamedViewport") && !option.toString().isEmpty() )
{
- const int pos = option.toString().indexOf('#');
+ const int pos = option.toString().indexOf(QLatin1Char('#'));
QString tmpUrl = pos == -1 ? option.toString() : option.toString().left(pos);
Okular::DocumentViewport viewport;
QMap<QString,int>::const_iterator it = m_urlPage.find(tmpUrl);
diff --git a/generators/chm/kio-msits/msits.cpp b/generators/chm/kio-msits/msits.cpp
index aae3003..f8e564c 100644
--- a/generators/chm/kio-msits/msits.cpp
+++ b/generators/chm/kio-msits/msits.cpp
@@ -75,7 +75,7 @@ ProtocolMSITS::~ProtocolMSITS()
// A simple stat() wrapper
static bool isDirectory ( const QString & filename )
{
- return filename.endsWith( '/' );
+ return filename.endsWith( QLatin1Char('/') );
}
@@ -271,7 +271,7 @@ void ProtocolMSITS::listDir (const QUrl & url)
if ( !parseLoadAndLookup ( url, filepath ) )
return; // error() has been called by parseLoadAndLookup
- filepath += '/';
+ filepath += QLatin1Char('/');
if ( !isDirectory (filepath) )
{
diff --git a/generators/chm/lib/libchmfile.cpp b/generators/chm/lib/libchmfile.cpp
index 4c56b18..60d03bc 100644
--- a/generators/chm/lib/libchmfile.cpp
+++ b/generators/chm/lib/libchmfile.cpp
@@ -73,12 +73,12 @@ bool LCHMFile::hasSearchTable( ) const
bool LCHMFile::parseTableOfContents( QVector< LCHMParsedEntry > * topics ) const
{
- return m_impl->parseFileAndFillArray( m_impl->m_topicsFile, topics, false );
+ return m_impl->parseFileAndFillArray( QString::fromLocal8Bit(m_impl->m_topicsFile), topics, false );
}
bool LCHMFile::parseIndex( QVector< LCHMParsedEntry > * indexes ) const
{
- return m_impl->parseFileAndFillArray( m_impl->m_indexFile, indexes, true );
+ return m_impl->parseFileAndFillArray( QString::fromLocal8Bit(m_impl->m_indexFile), indexes, true );
}
bool LCHMFile::getFileContentAsString( QString * str, const QString & url )
diff --git a/generators/chm/lib/libchmfile_search.cpp b/generators/chm/lib/libchmfile_search.cpp
index 7c42951..02c6a7c 100644
--- a/generators/chm/lib/libchmfile_search.cpp
+++ b/generators/chm/lib/libchmfile_search.cpp
@@ -219,9 +219,9 @@ bool LCHMFile::searchQuery( const QString& inquery, QStringList * searchresults,
{
// A phrase query found. Locate its boundaries, and parse it.
QString word = rxword.cap ( 1 );
- QChar type = '+';
+ QChar type = QLatin1Char('+');
- if ( word[0] == '-' || word[0] == '+' )
+ if ( word[0] == QLatin1Char('-') || word[0] == QLatin1Char('+') )
{
type = word[0];
word.remove (0, 1);
@@ -229,7 +229,7 @@ bool LCHMFile::searchQuery( const QString& inquery, QStringList * searchresults,
validateWord ( word, query_valid );
- if ( type == '-' )
+ if ( type == QLatin1Char('-') )
words_must_not_exist.push_back ( word );
else
words_must_exist.push_back ( word );
diff --git a/generators/chm/lib/libchmfileimpl.cpp b/generators/chm/lib/libchmfileimpl.cpp
index 6c65a49..3ae4e98 100644
--- a/generators/chm/lib/libchmfileimpl.cpp
+++ b/generators/chm/lib/libchmfileimpl.cpp
@@ -321,7 +321,7 @@ QString LCHMFileImpl::decodeEntity( const QString & entity )
}
// If entity is an ASCII code like &#12349; - just decode it
- if ( entity[0] == '#' )
+ if ( entity[0] == QLatin1Char('#') )
{
bool valid;
unsigned int ascode = entity.midRef(1).toUInt( &valid );
@@ -351,12 +351,12 @@ QString LCHMFileImpl::decodeEntity( const QString & entity )
inline int LCHMFileImpl::findStringInQuotes (const QString& tag, int offset, QString& value, bool firstquote, bool decodeentities)
{
- int qbegin = tag.indexOf ('"', offset);
+ int qbegin = tag.indexOf (QLatin1Char('"'), offset);
if ( qbegin == -1 )
qFatal ("LCHMFileImpl::findStringInQuotes: cannot find first quote in <param> tag: '%s'", qPrintable( tag ));
- int qend = firstquote ? tag.indexOf ('"', qbegin + 1) : tag.lastIndexOf ('"');
+ int qend = firstquote ? tag.indexOf (QLatin1Char('"'), qbegin + 1) : tag.lastIndexOf (QLatin1Char('"'));
if ( qend == -1 || qend <= qbegin )
qFatal ("LCHMFileImpl::findStringInQuotes: cannot find last quote in <param> tag: '%s'", qPrintable( tag ));
@@ -373,14 +373,14 @@ inline int LCHMFileImpl::findStringInQuotes (const QString& tag, int offset, QSt
{
if ( !fill_entity )
{
- if ( tag[i] == '&' ) // HTML entity starts
+ if ( tag[i] == QLatin1Char('&') ) // HTML entity starts
fill_entity = true;
else
value.append (tag[i]);
}
else
{
- if ( tag[i] == ';' ) // HTML entity ends
+ if ( tag[i] == QLatin1Char(';') ) // HTML entity ends
{
// If entity is an ASCII code, just decode it
QString decode = decodeEntity( htmlentity );
@@ -415,7 +415,7 @@ bool LCHMFileImpl::searchWord (const QString& text,
if ( text.isEmpty() || !m_searchAvailable )
return false;
- QString searchword = (QString) convertSearchWord (text);
+ QString searchword = QString::fromLocal8Bit( convertSearchWord (text) );
#define FTS_HEADER_LEN 0x32
unsigned char header[FTS_HEADER_LEN];
@@ -477,9 +477,9 @@ bool LCHMFileImpl::searchWord (const QString& text,
wrd_buf[word_len - 1] = 0;
if ( pos == 0 )
- word = wrd_buf;
+ word = QString::fromLocal8Bit(wrd_buf, word_len);
else
- word = word.mid (0, pos) + (const char*) wrd_buf;
+ word = word.mid (0, pos) + QString::fromLocal8Bit((const char*) wrd_buf, word_len);
delete[] wrd_buf;
@@ -584,9 +584,9 @@ inline uint32_t LCHMFileImpl::GetLeafNodeOffset(const QString& text,
wrd_buf[word_len - 1] = 0;
if ( pos == 0 )
- word = wrd_buf;
+ word = QString::fromLocal8Bit(wrd_buf, word_len);
else
- word = word.mid(0, pos) + (const char*) wrd_buf;
+ word = word.mid(0, pos) + QString::fromLocal8Bit((const char*) wrd_buf, word_len);
delete[] wrd_buf;
@@ -830,14 +830,14 @@ bool LCHMFileImpl::getInfoFromSystem()
if ( m_topicsFile.isEmpty() )
{
QString topicAttempt = QStringLiteral("/"), tmp;
- topicAttempt += QString ((const char*) buffer +index +2);
+ topicAttempt += QString::fromLocal8Bit ((const char*) buffer +index +2);
- tmp = topicAttempt + ".hhc";
+ tmp = topicAttempt + QStringLiteral(".hhc");
if ( ResolveObject( tmp, &ui) )
m_topicsFile = qPrintable( tmp );
- tmp = topicAttempt + ".hhk";
+ tmp = topicAttempt + QStringLiteral(".hhk");
if ( ResolveObject( tmp, &ui) )
m_indexFile = qPrintable( tmp );
@@ -848,7 +848,7 @@ bool LCHMFileImpl::getInfoFromSystem()
index += 2;
cursor = buffer + index;
- m_font = QString ((const char*) buffer + index + 2);
+ m_font = QString::fromLocal8Bit ((const char*) buffer + index + 2);
break;
default:
@@ -918,7 +918,7 @@ void LCHMFileImpl::getSearchResults( const LCHMSearchProgressResults& tempres,
continue;
combuf[COMMON_BUF_LEN - 1] = 0;
- results->push_back( LCHMUrlFactory::makeURLabsoluteIfNeeded( (const char*) combuf ) );
+ results->push_back( LCHMUrlFactory::makeURLabsoluteIfNeeded( QString::fromLocal8Bit((const char*) combuf) ) );
if ( --limit_results == 0 )
break;
@@ -928,7 +928,7 @@ void LCHMFileImpl::getSearchResults( const LCHMSearchProgressResults& tempres,
QString LCHMFileImpl::normalizeUrl( const QString & path ) const
{
- int pos = path.indexOf ('#');
+ int pos = path.indexOf (QLatin1Char('#'));
QString fixedpath = pos == -1 ? path : path.left (pos);
return LCHMUrlFactory::makeURLabsoluteIfNeeded( fixedpath );
@@ -971,18 +971,18 @@ bool LCHMFileImpl::parseFileAndFillArray( const QString & file, QVector< LCHMPar
// Split the HHC file by HTML tags
int stringlen = src.length();
- while ( pos < stringlen && (pos = src.indexOf ('<', pos)) != -1 )
+ while ( pos < stringlen && (pos = src.indexOf (QLatin1Char('<'), pos)) != -1 )
{
int i, word_end = 0;
for ( i = ++pos; i < stringlen; i++ )
{
// If a " or ' is found, skip to the next one.
- if ( (src[i] == '"' || src[i] == '\'') )
+ if ( (src[i] == QLatin1Char('"') || src[i] == QLatin1Char('\'')) )
{
// find where quote ends, either by another quote, or by '>' symbol (some people don't know HTML)
int nextpos = src.indexOf (src[i], i+1);
- if ( nextpos == -1 && (nextpos = src.indexOf ('>', i+1)) == -1 )
+ if ( nextpos == -1 && (nextpos = src.indexOf (QLatin1Char('>'), i+1)) == -1 )
{
qWarning ("LCHMFileImpl::ParseHhcAndFillTree: corrupted TOC: %s", qPrintable( src.mid(i) ));
return false;
@@ -990,9 +990,9 @@ bool LCHMFileImpl::parseFileAndFillArray( const QString & file, QVector< LCHMPar
i = nextpos;
}
- else if ( src[i] == '>' )
+ else if ( src[i] == QLatin1Char('>') )
break;
- else if ( !src[i].isLetterOrNumber() && src[i] != '/' && !word_end )
+ else if ( !src[i].isLetterOrNumber() && src[i] != QLatin1Char('/') && !word_end )
word_end = i;
}
@@ -1080,7 +1080,7 @@ bool LCHMFileImpl::parseFileAndFillArray( const QString & file, QVector< LCHMPar
entry.urls.push_back( url );
}
else if ( pname == QLatin1String("see also") && asIndex && entry.name != pvalue )
- entry.urls.push_back (":" + pvalue);
+ entry.urls.push_back (QLatin1Char(':') + pvalue);
else if ( pname == QLatin1String("imagenumber") )
{
bool bok;
@@ -1141,9 +1141,9 @@ bool LCHMFileImpl::getFileContentAsString( QString * str, const QString & url, b
if ( length > 0 )
{
buf.resize( length + 1 );
- buf [length] = '\0';
+ buf [length] = '\0';
- *str = internal_encoding ? (QString)( buf.constData() ) : encodeWithCurrentCodec( buf.constData() );
+ *str = internal_encoding ? QString::fromLocal8Bit( buf.constData() ) : encodeWithCurrentCodec( buf.constData() );
return true;
}
}
@@ -1165,7 +1165,7 @@ QString LCHMFileImpl::getTopicByUrl( const QString & url ) const
extern "C" int chm_enumerator_callback( struct chmFile*, struct chmUnitInfo *ui, void *context )
{
- ((QStringList*) context)->push_back( ui->path );
+ ((QStringList*) context)->push_back(QString::fromLocal8Bit( ui->path ) );
return CHM_ENUMERATOR_CONTINUE;
}
@@ -1266,7 +1266,7 @@ void LCHMFileImpl::fillTopicsUrlMap()
uint32_t off_url = get_int32_le( (uint32_t *)(topics.data() + i + 8) );
off_url = get_int32_le( (uint32_t *)( urltbl.data() + off_url + 8) ) + 8;
- QString url = LCHMUrlFactory::makeURLabsoluteIfNeeded( (const char*) urlstr.data() + off_url );
+ QString url = LCHMUrlFactory::makeURLabsoluteIfNeeded( QString::fromLocal8Bit ( (const char*) urlstr.data() + off_url ) );
if ( off_title < (uint32_t)strings.size() )
m_url2topics[url] = encodeWithCurrentCodec ( (const char*) strings.data() + off_title );
diff --git a/generators/chm/lib/libchmfileimpl.h b/generators/chm/lib/libchmfileimpl.h
index 86764fb..f8d7cc1 100644
--- a/generators/chm/lib/libchmfileimpl.h
+++ b/generators/chm/lib/libchmfileimpl.h
@@ -111,14 +111,14 @@ class LCHMFileImpl
//! Encode the string with the currently selected text codec, if possible. Or return as-is, if not.
inline QString encodeWithCurrentCodec( const QByteArray& str) const
{
- return (m_textCodec ? m_textCodec->toUnicode( str.constData () ) : str);
+ return (m_textCodec ? m_textCodec->toUnicode( str ) : QString::fromLocal8Bit(str));
}
//! Encode the string with the currently selected text codec, if possible. Or return as-is, if not.
inline QString encodeWithCurrentCodec (const char * str) const
- {
- return (m_textCodec ? m_textCodec->toUnicode( str ) : (QString) str);
- }
+ {
+ return (m_textCodec ? m_textCodec->toUnicode( str ) : QString::fromLocal8Bit(str));
+ }
//! Encode the string from internal files with the currently selected text codec, if possible.
//! Or return as-is, if not.
@@ -131,7 +131,7 @@ class LCHMFileImpl
//! Or return as-is, if not.
inline QString encodeInternalWithCurrentCodec (const char * str) const
{
- return (m_textCodecForSpecialFiles ? m_textCodecForSpecialFiles->toUnicode (str) : (QString) str);
+ return (m_textCodecForSpecialFiles ? m_textCodecForSpecialFiles->toUnicode ( str ) : QString::fromLocal8Bit(str));
}
//! Helper. Translates from Win32 encodings to generic wxWidgets ones.
diff --git a/generators/chm/lib/libchmtextencoding.cpp b/generators/chm/lib/libchmtextencoding.cpp
index 860193d..dd5a7c8 100644
--- a/generators/chm/lib/libchmtextencoding.cpp
+++ b/generators/chm/lib/libchmtextencoding.cpp
@@ -368,7 +368,7 @@ int LCHMFileImpl::getEncodingIndex( const LCHMTextEncoding * enc)
const LCHMTextEncoding * LCHMFileImpl::lookupByQtCodec(const QString & codec)
{
for ( const LCHMTextEncoding * t = text_encoding_table; t->family; t++ )
- if ( codec == t->qtcodec )
+ if ( codec == QString::fromLocal8Bit(t->qtcodec) )
return t;
return 0;
diff --git a/generators/chm/lib/libchmurlfactory.h b/generators/chm/lib/libchmurlfactory.h
index 59ddaa4..ddd4805 100644
--- a/generators/chm/lib/libchmurlfactory.h
+++ b/generators/chm/lib/libchmurlfactory.h
@@ -90,8 +90,8 @@ static inline QString makeURLabsoluteIfNeeded( const QString & url )
newurl = QDir::cleanPath (url);
// Normalize url, so it becomes absolute
- if ( newurl[0] != '/' )
- newurl = "/" + newurl;
+ if ( newurl[0] != QLatin1Char ('/') )
+ newurl = QLatin1Char('/') + newurl;
}
//qDebug ("makeURLabsolute (%s) -> (%s)", url.ascii(), newurl.ascii());
@@ -115,7 +115,7 @@ static inline bool handleFileType( const QString& link, QString& generated )
return false;
QString filelink = link.left( link.length() - intext.length() );
- generated = "<html><body><img src=\"" + filelink + "\"></body></html>";
+ generated = QStringLiteral("<html><body><img src=\"") + filelink + QStringLiteral("\"></body></html>");
return true;
}
diff --git a/generators/dvi/TeXFontDefinition.cpp b/generators/dvi/TeXFontDefinition.cpp
index 1cc1a7e..87861c7 100644
--- a/generators/dvi/TeXFontDefinition.cpp
+++ b/generators/dvi/TeXFontDefinition.cpp
@@ -103,7 +103,7 @@ void TeXFontDefinition::fontNameReceiver(const QString& fname)
// in the DVI file's directory. If that works, modify the filename
// accordingly and go on.
if (file == 0) {
- QString filename_test(font_pool->getExtraSearchPath() + '/' + filename);
+ QString filename_test(font_pool->getExtraSearchPath() + QLatin1Char('/') + filename);
file = fopen( QFile::encodeName(filename_test).constData(), "r");
if (file == 0) {
qCCritical(OkularDviDebug) << i18n("Cannot find font %1, file %2.", fontname, filename) << endl;
diff --git a/generators/dvi/TeXFont_PFB.cpp b/generators/dvi/TeXFont_PFB.cpp
index f5c08b8..0bb42c7 100644
--- a/generators/dvi/TeXFont_PFB.cpp
+++ b/generators/dvi/TeXFont_PFB.cpp
@@ -66,7 +66,7 @@ TeXFont_PFB::TeXFont_PFB(TeXFontDefinition *parent, fontEncoding *enc, double sl
}
if (face->family_name != 0)
- parent->fullFontName = face->family_name;
+ parent->fullFontName = QString::fromLocal8Bit(face->family_name);
// Finally, we need to set up the charMap array, which maps TeX
// character codes to glyph indices in the font. (Remark: the
diff --git a/generators/dvi/dviFile.cpp b/generators/dvi/dviFile.cpp
index fc5625b..a391b86 100644
--- a/generators/dvi/dviFile.cpp
+++ b/generators/dvi/dviFile.cpp
@@ -139,7 +139,7 @@ void dvifile::process_preamble()
magic_number = readUINT8();
strncpy(job_id, (char *)command_pointer, magic_number);
job_id[magic_number] = '\0';
- generatorString = job_id;
+ generatorString = QString::fromLocal8Bit(job_id);
}
@@ -205,7 +205,7 @@ void dvifile::read_postamble()
double enlargement_factor = (double(scale) * double(_magnification))/(double(design) * 1000.0);
if (font_pool != 0) {
- TeXFontDefinition *fontp = font_pool->appendx(fontname, checksum, scale, enlargement_factor);
+ TeXFontDefinition *fontp = font_pool->appendx(QString::fromLocal8Bit(fontname), checksum, scale, enlargement_factor);
// Insert font in dictionary and make sure the dictionary is big
// enough.
@@ -398,7 +398,7 @@ QString dvifile::convertPDFtoPS(const QString &PDFFilename, QString *converrorms
"contained in distributions of the ghostscript PostScript interpreter system. If "
"ghostscript is not installed on your system, you could install it now. "
"If you are sure that ghostscript is installed, try to use <strong>pdf2ps</strong> "
- "from the command line to check if it really works.</p><p><em>PATH:</em> %2</p></qt>", PDFFilename, QString(qgetenv("PATH")));
+ "from the command line to check if it really works.</p><p><em>PATH:</em> %2</p></qt>", PDFFilename, QString::fromLocal8Bit(qgetenv("PATH")));
have_complainedAboutMissingPDF2PS = true;
}
return QString();
@@ -411,7 +411,7 @@ QString dvifile::convertPDFtoPS(const QString &PDFFilename, QString *converrorms
// Indicates that conversion failed, won't try again.
convertedFiles[PDFFilename].clear();
if (converrorms != 0) {
- const QString output = pdf2ps.readAll();
+ const QString output = QString::fromLocal8Bit(pdf2ps.readAll());
*converrorms = i18n("<qt><p>The PDF-file %1 could not be converted to PostScript. Some graphic elements in your "
"document will therefore not be displayed.</p>"
diff --git a/generators/dvi/dviRenderer.cpp b/generators/dvi/dviRenderer.cpp
index 7570438..1aca1fd 100644
--- a/generators/dvi/dviRenderer.cpp
+++ b/generators/dvi/dviRenderer.cpp
@@ -205,7 +205,7 @@ void dviRenderer::drawPage(RenderedDocumentPagePixmap* page)
while (hi.linkText == hj.linkText && hi.baseline == hj.baseline)
{
merged = true;
- hi.box = hi.box.unite(hj.box);
+ hi.box = hi.box.united(hj.box);
j++;
if (j == page->hyperLinkList.end())
@@ -494,7 +494,7 @@ bool dviRenderer::setFile(const QString &fname, const QUrl &base)
QString includePath;
if (!baseURL.isLocalFile()) {
includePath = filename;
- includePath.truncate(includePath.lastIndexOf('/'));
+ includePath.truncate(includePath.lastIndexOf(QLatin1Char('/')));
}
PS_interface->setIncludePath(includePath);
@@ -638,7 +638,7 @@ Anchor dviRenderer::parseReference(const QString &reference)
QVector<DVI_SourceFileAnchor>::iterator it;
for( it = sourceHyperLinkAnchors.begin(); it != sourceHyperLinkAnchors.end(); ++it )
if (refFileName.trimmed() == it->fileName.trimmed()
- || refFileName.trimmed() == it->fileName.trimmed() + ".tex"
+ || refFileName.trimmed() == it->fileName.trimmed() + QStringLiteral(".tex")
) {
anchorForRefFileFound = true;
diff --git a/generators/dvi/dviRenderer_draw.cpp b/generators/dvi/dviRenderer_draw.cpp
index e4e4cd7..857d277 100644
--- a/generators/dvi/dviRenderer_draw.cpp
+++ b/generators/dvi/dviRenderer_draw.cpp
@@ -165,7 +165,7 @@ void dviRenderer::set_char(unsigned int cmd, unsigned int ch)
break;
case 0x7b:
- currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += '-';
+ currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += QLatin1Char('-');
break;
case 0x7c:
currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += QLatin1String("---");
@@ -174,7 +174,7 @@ void dviRenderer::set_char(unsigned int cmd, unsigned int ch)
currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += QLatin1String("\"");
break;
case 0x7e:
- currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += '~';
+ currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += QLatin1Char('~');
break;
case 0x7f:
currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += QLatin1String("@@"); // @@@ check!
@@ -184,7 +184,7 @@ void dviRenderer::set_char(unsigned int cmd, unsigned int ch)
if ((ch >= 0x21) && (ch <= 0x7a))
currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += QChar(ch);
else
- currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += '?';
+ currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += QLatin1Char('?');
break;
}
@@ -465,7 +465,7 @@ void dviRenderer::draw_part(double current_dimconv, bool is_vfmacro)
line_boundary_encountered = true;
space_encountered = true;
if (abs(DDtmp) >= 10*(currinf.fontp->scaled_size_in_DVI_units/6))
- currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += '\n';
+ currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += QLatin1Char('\n');
}
currinf.data.dvi_v += ((long) (DDtmp * current_dimconv))/65536;
currinf.data.pxl_v = int(currinf.data.dvi_v/shrinkfactor);
@@ -487,7 +487,7 @@ void dviRenderer::draw_part(double current_dimconv, bool is_vfmacro)
line_boundary_encountered = true;
space_encountered = true;
if (abs(YYtmp) >= 10*(currinf.fontp->scaled_size_in_DVI_units/6))
- currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += '\n';
+ currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += QLatin1Char('\n');
}
currinf.data.dvi_v += currinf.data.y/65536;
currinf.data.pxl_v = int(currinf.data.dvi_v/shrinkfactor);
@@ -508,7 +508,7 @@ void dviRenderer::draw_part(double current_dimconv, bool is_vfmacro)
line_boundary_encountered = true;
space_encountered = true;
if (abs(ZZtmp) >= 10*(currinf.fontp->scaled_size_in_DVI_units/6))
- currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += '\n';
+ currentlyDrawnPage->textBoxList[currentlyDrawnPage->textBoxList.size()-1].text += QLatin1Char('\n');
}
currinf.data.dvi_v += currinf.data.z/65536;
currinf.data.pxl_v = int(currinf.data.dvi_v/shrinkfactor);
@@ -594,7 +594,7 @@ void dviRenderer::draw_part(double current_dimconv, bool is_vfmacro)
/* heuristic to properly detect newlines; a space is needed */
if (after_space &&
line_boundary_encountered && word_boundary_encountered) {
- if (currentlyDrawnPage->textBoxList.last().text.endsWith('\n'))
+ if (currentlyDrawnPage->textBoxList.last().text.endsWith(QLatin1Char('\n')))
currentlyDrawnPage->textBoxList.last().text.chop(1);
currentlyDrawnPage->textBoxList.last().text += QLatin1String(" \n");
after_space = false;
diff --git a/generators/dvi/dviRenderer_prescan.cpp b/generators/dvi/dviRenderer_prescan.cpp
index bce2185..7c68597 100644
--- a/generators/dvi/dviRenderer_prescan.cpp
+++ b/generators/dvi/dviRenderer_prescan.cpp
@@ -48,7 +48,7 @@ void dviRenderer::prescan_embedPS(char *cp, quint8 *beginningOfSpecialCommand)
if (qstrnicmp(cp, "PSfile=", 7) != 0)
return;
- QString command(cp+7);
+ QString command = QString::fromLocal8Bit(cp+7);
QString include_command = command.simplified();
@@ -58,13 +58,13 @@ void dviRenderer::prescan_embedPS(char *cp, quint8 *beginningOfSpecialCommand)
// (already the simplified() above is wrong). If you have
// files like this, go away.
QString EPSfilename = include_command;
- EPSfilename.truncate(EPSfilename.indexOf(' '));
+ EPSfilename.truncate(EPSfilename.indexOf(QLatin1Char(' ')));
// Strip enclosing quotation marks which are included by some LaTeX
// macro packages (but not by others). This probably means that
// graphic files are no longer found if the filename really does
// contain quotes, but we don't really care that much.
- if ((EPSfilename.at(0) == '\"') && (EPSfilename.at(EPSfilename.length()-1) == '\"'))
+ if ((EPSfilename.at(0) == QLatin1Char('"')) && (EPSfilename.at(EPSfilename.length()-1) == QLatin1Char('"')))
EPSfilename = EPSfilename.mid(1,EPSfilename.length()-2);
// Now locate the Gfx file on the hard disk...
@@ -119,7 +119,7 @@ void dviRenderer::prescan_embedPS(char *cp, quint8 *beginningOfSpecialCommand)
int angle = 0;
// just to avoid ambiguities; the filename could contain keywords
- include_command = include_command.mid(include_command.indexOf(' '));
+ include_command = include_command.mid(include_command.indexOf(QLatin1Char(' ')));
parse_special_argument(include_command, "llx=", &llx);
parse_special_argument(include_command, "lly=", &lly);
@@ -140,19 +140,19 @@ void dviRenderer::prescan_embedPS(char *cp, quint8 *beginningOfSpecialCommand)
if (angle != 0)
PS.append( QStringLiteral(" %1 @angle").arg(angle) );
if (clip != -1)
- PS.append(" @clip");
- PS.append( " @setspecial\n" );
+ PS.append( QStringLiteral( " @clip" ));
+ PS.append( QStringLiteral( " @setspecial\n" ) );
QFile file( EPSfilename );
if ( file.open( QIODevice::ReadOnly ) ) {
QTextStream stream( &file );
while ( !stream.atEnd() ) {
- PS += stream.readLine().section( '%', 0, 0);
- PS += '\n';
+ PS += stream.readLine().section( QLatin1Char('%'), 0, 0);
+ PS += QLatin1Char('\n');
}
file.close();
}
- PS.append( "@endspecial" );
+ PS.append( QStringLiteral("@endspecial") );
PS = PS.simplified();
@@ -247,7 +247,7 @@ void dviRenderer::prescan_ParsePapersizeSpecial(const QString& _cp)
QString cp = _cp.simplified();
- if (cp[0] == '=') {
+ if (cp[0] == QLatin1Char('=')) {
cp = cp.mid(1);
dviFile->suggestedPageSize = new pageSize;
dviFile->suggestedPageSize->setPageSize(cp);
@@ -271,7 +271,7 @@ void dviRenderer::prescan_ParseBackgroundSpecial(const QString& cp)
void dviRenderer::prescan_ParseHTMLAnchorSpecial(const QString& _cp)
{
QString cp = _cp;
- cp.truncate(cp.indexOf('"'));
+ cp.truncate(cp.indexOf(QLatin1Char('"')));
Length l;
l.setLength_in_inch(currinf.data.dvi_v/(resolutionInDPI*shrinkfactor));
anchorList[cp] = Anchor(current_page+1, l);
@@ -308,9 +308,9 @@ void dviRenderer::prescan_ParsePSBangSpecial(const QString& cp)
qCDebug(OkularDviDebug) << "PostScript-special, literal header " << cp;
#endif
- PS_interface->PostScriptHeaderString->append( " @defspecial \n" );
+ PS_interface->PostScriptHeaderString->append( QStringLiteral( " @defspecial \n" ) );
PS_interface->PostScriptHeaderString->append( cp );
- PS_interface->PostScriptHeaderString->append( " @fedspecial \n" );
+ PS_interface->PostScriptHeaderString->append( QStringLiteral ( " @fedspecial \n" ) );
}
@@ -323,9 +323,9 @@ void dviRenderer::prescan_ParsePSQuoteSpecial(const QString& cp)
double PS_H = (currinf.data.dvi_h*300.0)/(65536*1200)-300;
double PS_V = (currinf.data.dvi_v*300.0)/1200 - 300;
PostScriptOutPutString->append( QStringLiteral(" %1 %2 moveto\n").arg(PS_H).arg(PS_V) );
- PostScriptOutPutString->append( " @beginspecial @setspecial \n" );
+ PostScriptOutPutString->append( QStringLiteral(" @beginspecial @setspecial \n") );
PostScriptOutPutString->append( cp );
- PostScriptOutPutString->append( " @endspecial \n" );
+ PostScriptOutPutString->append( QStringLiteral(" @endspecial \n") );
}
@@ -357,21 +357,21 @@ void dviRenderer::prescan_ParsePSSpecial(const QString& cp)
return; // hyperref tries to work around Distiller bug
if (cp.startsWith(QLatin1String("ps:SDict begin [")) && cp.endsWith(QLatin1String(" pdfmark end"))) { // hyperref definition of link/anchor/bookmark/etc
if (cp.contains(QStringLiteral("/DEST"))) { // The PostScript code defines an anchor
- QString anchorName = cp.section('(', 1, 1).section(')', 0, 0);
+ QString anchorName = cp.section(QLatin1Char('('), 1, 1).section(QLatin1Char(')'), 0, 0);
Length l;
l.setLength_in_inch(currinf.data.dvi_v/(resolutionInDPI*shrinkfactor));
anchorList[anchorName] = Anchor(current_page+1, l);
}
// The PostScript code defines a bookmark
if (cp.contains(QStringLiteral("/Dest")) && cp.contains(QStringLiteral("/Title"))) {
- const QString childrenNumberAndMoreStuff = cp.section('-', 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;
foreach(const QChar &c, childrenNumberAndMoreStuff) {
if (c.isDigit()) ++indexOfFirstNonDigit;
else break;
}
- prebookmarks.append(PreBookmark(PDFencodingToQString(cp.section('(', 2, 2).section(')', 0, 0)),
- cp.section('(', 1, 1).section(')', 0, 0),
+ prebookmarks.append(PreBookmark(PDFencodingToQString(cp.section(QLatin1Char('('), 2, 2).section(QLatin1Char(')'), 0, 0)),
+ cp.section(QLatin1Char('('), 1, 1).section(QLatin1Char(')'), 0, 0),
childrenNumberAndMoreStuff.leftRef(indexOfFirstNonDigit).toUInt()
));
}
@@ -414,19 +414,19 @@ void dviRenderer::prescan_ParsePSFileSpecial(const QString& cp)
// (already the simplified() above is wrong). If you have
// files like this, go away.
QString EPSfilename = include_command;
- EPSfilename.truncate(EPSfilename.indexOf(' '));
+ EPSfilename.truncate(EPSfilename.indexOf(QLatin1Char(' ')));
// Strip enclosing quotation marks which are included by some LaTeX
// macro packages (but not by others). This probably means that
// graphic files are no longer found if the filename really does
// contain quotes, but we don't really care that much.
- if ((EPSfilename.at(0) == '\"') && (EPSfilename.at(EPSfilename.length()-1) == '\"')) {
+ if ((EPSfilename.at(0) == QLatin1Char('\"')) && (EPSfilename.at(EPSfilename.length()-1) == QLatin1Char('\"'))) {
EPSfilename = EPSfilename.mid(1,EPSfilename.length()-2);
}
// If the file name ends in 'png', 'gif', 'jpg' or 'jpeg', we assume
// that this is NOT a PostScript file, and we exit here.
- QString ending = EPSfilename.section('.', -1).toLower();
+ QString ending = EPSfilename.section(QLatin1Char('.'), -1).toLower();
if ((ending == QLatin1String("png")) || (ending == QLatin1String("gif")) || (ending == QLatin1String("jpg")) || (ending == QLatin1String("jpeg"))) {
dviFile->numberOfExternalNONPSFiles++;
return;
@@ -459,7 +459,7 @@ void dviRenderer::prescan_ParsePSFileSpecial(const QString& cp)
int angle = 0;
// just to avoid ambiguities; the filename could contain keywords
- include_command = include_command.mid(include_command.indexOf(' '));
+ include_command = include_command.mid(include_command.indexOf(QLatin1Char(' ')));
parse_special_argument(include_command, "llx=", &llx);
parse_special_argument(include_command, "lly=", &lly);
@@ -475,7 +475,7 @@ void dviRenderer::prescan_ParsePSFileSpecial(const QString& cp)
double PS_H = (currinf.data.dvi_h*300.0)/(65536*1200)-300;
double PS_V = (currinf.data.dvi_v*300.0)/1200 - 300;
PostScriptOutPutString->append( QStringLiteral(" %1 %2 moveto\n").arg(PS_H).arg(PS_V) );
- PostScriptOutPutString->append( "@beginspecial " );
+ PostScriptOutPutString->append( QStringLiteral("@beginspecial ") );
PostScriptOutPutString->append( QStringLiteral(" %1 @llx").arg(llx) );
PostScriptOutPutString->append( QStringLiteral(" %1 @lly").arg(lly) );
PostScriptOutPutString->append( QStringLiteral(" %1 @urx").arg(urx) );
@@ -487,10 +487,10 @@ void dviRenderer::prescan_ParsePSFileSpecial(const QString& cp)
if (angle != 0)
PostScriptOutPutString->append( QStringLiteral(" %1 @angle").arg(angle) );
if (clip != -1)
- PostScriptOutPutString->append(" @clip");
- PostScriptOutPutString->append( " @setspecial \n" );
+ PostScriptOutPutString->append( QStringLiteral(" @clip"));
+ PostScriptOutPutString->append( QStringLiteral(" @setspecial \n") );
PostScriptOutPutString->append( QStringLiteral(" (%1) run\n").arg(EPSfilename) );
- PostScriptOutPutString->append( "@endspecial \n" );
+ PostScriptOutPutString->append( QStringLiteral("@endspecial \n") );
}
return;
diff --git a/generators/dvi/dviexport.cpp b/generators/dvi/dviexport.cpp
index 5d6b56c..ad74b5f 100644
--- a/generators/dvi/dviexport.cpp
+++ b/generators/dvi/dviexport.cpp
@@ -108,7 +108,7 @@ void DVIExport::finished_impl(int exit_code)
void DVIExport::output_receiver()
{
if (process_) {
- QString out = process_->readAllStandardOutput();
+ QString out = QString::fromLocal8Bit(process_->readAllStandardOutput());
}
}
@@ -138,7 +138,7 @@ DVIExportToPDF::DVIExportToPDF(dviRenderer& parent, const QString& output_name)
}
// Generate a suggestion for a reasonable file name
- const QString suggested_name = dvi.filename.left(dvi.filename.indexOf(QStringLiteral("."))) + ".pdf";
+ const QString suggested_name = dvi.filename.left(dvi.filename.indexOf(QStringLiteral("."))) + QStringLiteral(".pdf");
if (output_name.isEmpty())
return;
diff --git a/generators/dvi/dvisourcesplitter.cpp b/generators/dvi/dvisourcesplitter.cpp
index 10649b3..f9b82db 100644
--- a/generators/dvi/dvisourcesplitter.cpp
+++ b/generators/dvi/dvisourcesplitter.cpp
@@ -39,7 +39,7 @@ DVI_SourceFileSplitter::DVI_SourceFileSplitter(const QString &srclink, const QSt
filepart = filepart.mid(i);
//check for number mix up
- if ( filepart[0] != ' ' && (linepart.length() != 1) ) possibleNumberMixUp = true;
+ if ( filepart[0] != QLatin1Char(' ') && (linepart.length() != 1) ) possibleNumberMixUp = true;
//remove a spaces
filepart = filepart.trimmed();
@@ -54,8 +54,8 @@ DVI_SourceFileSplitter::DVI_SourceFileSplitter(const QString &srclink, const QSt
bool fiExists = m_fileInfo.exists();
//if it doesn't exist, but adding ".tex"
- if ( !fiExists && QFileInfo(m_fileInfo.absoluteFilePath() + ".tex").exists() )
- m_fileInfo.setFile(m_fileInfo.absoluteFilePath() + ".tex");
+ if ( !fiExists && QFileInfo(m_fileInfo.absoluteFilePath() + QStringLiteral(".tex")).exists() )
+ m_fileInfo.setFile(m_fileInfo.absoluteFilePath() + QStringLiteral(".tex"));
//if that doesn't help either, perhaps the file started with a
//number: move the numbers from the sourceline to the filename
@@ -73,7 +73,7 @@ DVI_SourceFileSplitter::DVI_SourceFileSplitter(const QString &srclink, const QSt
qCDebug(OkularDviDebug) << "DVI_SourceSplitter: trying " << tempInfo.fileName();
#endif
if ( tempInfo.exists() ) { found = true; break;}
- tempInfo.setFile(linepart.right(index) + tempFileName + ".tex");
+ tempInfo.setFile(linepart.right(index) + tempFileName + QStringLiteral(".tex"));
#ifdef DEBUG_SOURCESPLITTER
qCDebug(OkularDviDebug) << "DVI_SourceSplitter: trying " << tempInfo.fileName();
#endif
diff --git a/generators/dvi/fontEncoding.cpp b/generators/dvi/fontEncoding.cpp
index 6293fcc..b51ea36 100644
--- a/generators/dvi/fontEncoding.cpp
+++ b/generators/dvi/fontEncoding.cpp
@@ -44,7 +44,7 @@ fontEncoding::fontEncoding(const QString &encName)
// We wait here while the external program runs concurrently.
kpsewhich.waitForFinished(-1);
- const QString encFileName = QString(kpsewhich.readAll()).trimmed();
+ const QString encFileName = QString::fromLocal8Bit(kpsewhich.readAll()).trimmed();
if (encFileName.isEmpty()) {
qCCritical(OkularDviDebug) << QStringLiteral("fontEncoding::fontEncoding(...): The file '%1' could not be found by kpsewhich.").arg(encName) << endl;
return;
@@ -61,19 +61,19 @@ fontEncoding::fontEncoding(const QString &encName)
QTextStream stream( &file );
QString fileContent;
while ( !stream.atEnd() )
- fileContent += stream.readLine().section('%', 0, 0); // line of text excluding '\n' until first '%'-sign
+ fileContent += stream.readLine().section(QLatin1Char('%'), 0, 0); // line of text excluding '\n' until first '%'-sign
file.close();
fileContent = fileContent.trimmed();
// Find the name of the encoding
- encodingFullName = fileContent.section('[', 0, 0).simplified().mid(1);
+ encodingFullName = fileContent.section(QLatin1Char('['), 0, 0).simplified().mid(1);
#ifdef DEBUG_FONTENC
qCDebug(OkularDviDebug) << "encodingFullName: " << encodingFullName;
#endif
- fileContent = fileContent.section('[', 1, 1).section(']',0,0).simplified();
- const QStringList glyphNameList = fileContent.split('/', QString::SkipEmptyParts);
+ fileContent = fileContent.section(QLatin1Char('['), 1, 1).section(QLatin1Char(']'),0,0).simplified();
+ const QStringList glyphNameList = fileContent.split(QLatin1Char('/'), QString::SkipEmptyParts);
int i = 0;
for ( QStringList::ConstIterator it = glyphNameList.constBegin(); (it != glyphNameList.constEnd())&&(i<256); ++it ) {
diff --git a/generators/dvi/fontMap.cpp b/generators/dvi/fontMap.cpp
index 7e10ba2..f6d19fc 100644
--- a/generators/dvi/fontMap.cpp
+++ b/generators/dvi/fontMap.cpp
@@ -48,7 +48,7 @@ fontMap::fontMap()
// We wait here while the external program runs concurrently.
kpsewhich.waitForFinished(-1);
- QString map_fileName = QString(kpsewhich.readAll()).trimmed();
+ QString map_fileName = QString::fromLocal8Bit(kpsewhich.readAll()).trimmed();
if (map_fileName.isEmpty()) {
// Map file not found? Then we try the teTeX < 3.0 way of finding
// the file.
@@ -62,7 +62,7 @@ fontMap::fontMap()
kpsewhich.waitForFinished(-1);
- map_fileName = QString(kpsewhich.readAll()).trimmed();
+ map_fileName = QString::fromLocal8Bit(kpsewhich.readAll()).trimmed();
// If both versions fail, then there is nothing left to do.
if (map_fileName.isEmpty()) {
qCCritical(OkularDviDebug) << "fontMap::fontMap(): The file 'ps2pk.map' could not be found by kpsewhich." << endl;
@@ -76,23 +76,23 @@ fontMap::fontMap()
QString line;
while ( !stream.atEnd() ) {
line = stream.readLine().simplified();
- if (line.isEmpty() || (line.at(0) == '%'))
+ if (line.isEmpty() || (line.at(0) == QLatin1Char('%')))
continue;
- QString TeXName = line.section(' ', 0, 0);
- QString FullName = line.section(' ', 1, 1);
- QString fontFileName = line.section('<', -1).trimmed().section(' ', 0, 0);
- QString encodingName = line.section('<', -2, -2).trimmed().section(' ', 0, 0);
+ QString TeXName = line.section(QLatin1Char(' '), 0, 0);
+ QString FullName = line.section(QLatin1Char(' '), 1, 1);
+ QString fontFileName = line.section(QLatin1Char('<'), -1).trimmed().section(QLatin1Char(' '), 0, 0);
+ QString encodingName = line.section(QLatin1Char('<'), -2, -2).trimmed().section(QLatin1Char(' '), 0, 0);
// It seems that sometimes the encoding is prepended by the
// letter '[', which we ignore
- if ((!encodingName.isEmpty()) && (encodingName[0] == '['))
+ if ((!encodingName.isEmpty()) && (encodingName[0] == QLatin1Char('[')))
encodingName = encodingName.mid(1);
double slant = 0.0;
int i = line.indexOf(QStringLiteral("SlantFont"));
if (i >= 0) {
bool ok;
- slant = line.left(i).section(' ', -1, -1 ,QString::SectionSkipEmpty).toDouble(&ok);
+ slant = line.left(i).section(QLatin1Char(' '), -1, -1 ,QString::SectionSkipEmpty).toDouble(&ok);
if (ok == false)
slant = 0.0;
}
diff --git a/generators/dvi/fontpool.cpp b/generators/dvi/fontpool.cpp
index c326107..918ea16 100644
--- a/generators/dvi/fontpool.cpp
+++ b/generators/dvi/fontpool.cpp
@@ -210,7 +210,7 @@ void fontPool::locateFonts()
"which are necessary to display the current DVI file. "
"Your document might be unreadable.</p>"
"<p><small><b>PATH:</b> %1</small></p>"
- "<p><small>%2</small></p></qt>", QString(qgetenv("PATH")),
+ "<p><small>%2</small></p></qt>", QString::fromLocal8Bit(qgetenv("PATH")),
kpsewhichOutput.replace(QLatin1String("\n"), QLatin1String("<br/>"))), -1);
}
}
@@ -230,7 +230,7 @@ void fontPool::locateFonts(bool makePK, bool locateTFMonly, bool *virtualFontsFo
<< QStringLiteral("--mode") << QStringLiteral("lexmarks");
// Disable automatic pk-font generation.
- kpsewhich_args << (makePK ? "--mktex" : "--no-mktex") << QStringLiteral("pk");
+ kpsewhich_args << QString::fromLocal8Bit(makePK ? "--mktex" : "--no-mktex") << QStringLiteral("pk");
// Names of fonts that shall be located
quint16 numFontsInJob = 0;
@@ -270,7 +270,7 @@ void fontPool::locateFonts(bool makePK, bool locateTFMonly, bool *virtualFontsFo
// a real command line, but who cares?
const QString kpsewhich_exe = QStringLiteral("kpsewhich");
kpsewhichOutput +=
- "<b>" + kpsewhich_exe + ' ' + kpsewhich_args.join(QStringLiteral(" ")) + "</b>";
+ QStringLiteral("<b>") + kpsewhich_exe + QLatin1Char(' ') + kpsewhich_args.join(QStringLiteral(" ")) + QStringLiteral("</b>");
kpsewhich_->start(kpsewhich_exe, kpsewhich_args,
QIODevice::ReadOnly|QIODevice::Text);
@@ -281,7 +281,7 @@ void fontPool::locateFonts(bool makePK, bool locateTFMonly, bool *virtualFontsFo
"Possible reason: the <em>kpsewhich</em> program is perhaps not installed on your system, "
"or it cannot be found in the current search path.</p>"
"<p><small><b>PATH:</b> %1</small></p>"
- "<p><small>%2</small></p></qt>", QString(qgetenv("PATH")),
+ "<p><small>%2</small></p></qt>", QString::fromLocal8Bit(qgetenv("PATH")),
kpsewhichOutput.replace(QLatin1String("\n"), QLatin1String("<br/>"))), -1);
// This makes sure the we don't try to run kpsewhich again
@@ -306,7 +306,7 @@ void fontPool::locateFonts(bool makePK, bool locateTFMonly, bool *virtualFontsFo
// Create a list with all filenames found by the kpsewhich program.
const QStringList fileNameList =
- QString(kpsewhich_->readAll()).split('\n', QString::SkipEmptyParts);
+ QString::fromLocal8Bit(kpsewhich_->readAll()).split(QLatin1Char('\n'), QString::SkipEmptyParts);
// Now associate the file names found with the fonts
QList<TeXFontDefinition*>::iterator it_fontp = fontList.begin();
@@ -321,7 +321,7 @@ void fontPool::locateFonts(bool makePK, bool locateTFMonly, bool *virtualFontsFo
matchingFiles = fileNameList.filter(fn);
#endif
if (matchingFiles.isEmpty() == true)
- matchingFiles += fileNameList.filter("/"+fontp->fontname+".");
+ matchingFiles += fileNameList.filter(QLatin1Char('/') + fontp->fontname + QLatin1Char('.'));
if (matchingFiles.isEmpty() != true) {
#ifdef DEBUG_FONTPOOL
@@ -450,7 +450,7 @@ void fontPool::mf_output_receiver()
// We'd like to print only full lines of text.
int numleft;
- while( (numleft = MetafontOutput.indexOf('\n')) != -1) {
+ while( (numleft = MetafontOutput.indexOf(QLatin1Char('\n'))) != -1) {
QString line = MetafontOutput.left(numleft+1);
#ifdef DEBUG_FONTPOOL
qCDebug(OkularDviDebug) << "MF OUTPUT RECEIVED: " << line;
@@ -468,9 +468,9 @@ void fontPool::mf_output_receiver()
// are generating. The second-to-last word is the resolution in
// dots per inch. Display this info in the text label below the
// progress bar.
- int lastblank = startLine.lastIndexOf(' ');
+ int lastblank = startLine.lastIndexOf(QLatin1Char(' '));
QString fontName = startLine.mid(lastblank+1);
- int secondblank = startLine.lastIndexOf(' ',lastblank-1);
+ int secondblank = startLine.lastIndexOf(QLatin1Char(' '),lastblank-1);
QString dpi = startLine.mid(secondblank+1,lastblank-secondblank-1);
emit warning( i18n("Currently generating %1 at %2 dpi...", fontName, dpi), -1 );
diff --git a/generators/dvi/length.cpp b/generators/dvi/length.cpp
index 956dda8..55ab4e3 100644
--- a/generators/dvi/length.cpp
+++ b/generators/dvi/length.cpp
@@ -57,7 +57,7 @@ float Length::convertToMM(const QString &distance, bool *ok)
// of the unit in 'unitPos', so that distance[0..unitPos] will hold
// the value. Store the number of mm per unit in 'MMperUnit'.
for(int i=0; MMperUnit==0.0 && distanceUnitTable[i].name != 0; i++) {
- unitPos = distance.lastIndexOf(distanceUnitTable[i].name);
+ unitPos = distance.lastIndexOf(QString::fromLocal8Bit(distanceUnitTable[i].name));
if (unitPos != -1)
MMperUnit = distanceUnitTable[i].mmPerUnit;
}
diff --git a/generators/dvi/pageSize.cpp b/generators/dvi/pageSize.cpp
index 73f13ed..fc9308c 100644
--- a/generators/dvi/pageSize.cpp
+++ b/generators/dvi/pageSize.cpp
@@ -64,7 +64,7 @@ bool pageSize::setPageSize(const QString& name)
// See if we can recognize the string
QString currentName;
for(int i=0; staticList[i].name != 0; i++) {
- currentName = staticList[i].name;
+ currentName = QString::fromLocal8Bit(staticList[i].name);
if (currentName == name) {
currentSize = i;
// Set page width/height accordingly
@@ -78,10 +78,10 @@ bool pageSize::setPageSize(const QString& name)
// Check if the string contains 'x'. If yes, we assume it is of type
// "<number>x<number>". If yes, the first number is interpreted as
// the width in mm, the second as the height in mm
- if (name.indexOf('x') >= 0) {
+ if (name.indexOf(QLatin1Char('x')) >= 0) {
bool wok, hok;
- float pageWidth_tmp = name.section('x',0,0).toFloat(&wok);
- float pageHeight_tmp = name.section('x',1,1).toFloat(&hok);
+ float pageWidth_tmp = name.section(QLatin1Char('x'),0,0).toFloat(&wok);
+ float pageHeight_tmp = name.section(QLatin1Char('x'),1,1).toFloat(&hok);
if (wok && hok) {
pageWidth.setLength_in_mm(pageWidth_tmp);
pageHeight.setLength_in_mm(pageHeight_tmp);
@@ -96,10 +96,10 @@ bool pageSize::setPageSize(const QString& name)
// Check if the string contains ','. If yes, we assume it is of type
// "<number><unit>,<number><uni>". The first number is supposed to
// be the width, the second the height.
- if (name.indexOf(',') >= 0) {
+ if (name.indexOf(QLatin1Char(',')) >= 0) {
bool wok, hok;
- float pageWidth_tmp = Length::convertToMM(name.section(',',0,0), &wok);
- float pageHeight_tmp = Length::convertToMM(name.section(',',1,1), &hok);
+ float pageWidth_tmp = Length::convertToMM(name.section(QLatin1Char(','),0,0), &wok);
+ float pageHeight_tmp = Length::convertToMM(name.section(QLatin1Char(','),1,1), &hok);
if (wok && hok) {
pageWidth.setLength_in_mm(pageWidth_tmp);
pageHeight.setLength_in_mm(pageHeight_tmp);
@@ -205,7 +205,7 @@ void pageSize::rectifySizes()
QString pageSize::preferredUnit() const
{
if (currentSize >= 0)
- return staticList[currentSize].preferredUnit;
+ return QString::fromLocal8Bit(staticList[currentSize].preferredUnit);
// User-defined size. Give a preferred unit depening on the locale.
if (QLocale::system().measurementSystem() == QLocale::MetricSystem)
@@ -250,7 +250,7 @@ QStringList pageSize::pageSizeNames()
QStringList names;
for(int i=0; staticList[i].name != 0; i++)
- names << staticList[i].name;
+ names << QString::fromLocal8Bit(staticList[i].name);
return names;
}
@@ -259,7 +259,7 @@ QStringList pageSize::pageSizeNames()
QString pageSize::formatName() const
{
if (currentSize >= 0)
- return staticList[currentSize].name;
+ return QString::fromLocal8Bit(staticList[currentSize].name);
else
return QString();
}
@@ -300,7 +300,7 @@ void pageSize::setOrientation(int orient)
QString pageSize::serialize() const
{
if ((currentSize >= 0) && (fabs(staticList[currentSize].height-pageHeight.getLength_in_mm()) <= 0.5))
- return staticList[currentSize].name;
+ return QString::fromLocal8Bit(staticList[currentSize].name);
else
return QStringLiteral("%1x%2").arg(pageWidth.getLength_in_mm()).arg(pageHeight.getLength_in_mm());
}
@@ -318,13 +318,13 @@ QString pageSize::description() const
else
size += QStringLiteral("%1x%2 in").arg(width().getLength_in_inch(), 0, 'g', 2).arg(height().getLength_in_inch(), 0, 'g', 2);
} else {
- size += formatName() + '/';
+ size += formatName() + QLatin1Char('/');
if (getOrientation() == 0)
size += i18n("portrait");
else
size += i18n("landscape");
}
- return size + ' ';
+ return size + QLatin1Char(' ');
}
diff --git a/generators/dvi/psgs.cpp b/generators/dvi/psgs.cpp
index 466e642..ff44251 100644
--- a/generators/dvi/psgs.cpp
+++ b/generators/dvi/psgs.cpp
@@ -83,9 +83,9 @@ void ghostscript_interface::setPostScript(const PageNumber& page, const QString&
void ghostscript_interface::setIncludePath(const QString &_includePath) {
if (_includePath.isEmpty())
- includePath = QStringLiteral("*"); // Allow all files
+ includePath = QLatin1Char('*'); // Allow all files
else
- includePath = _includePath+"/*";
+ includePath = _includePath + QStringLiteral("/*");
}
@@ -214,7 +214,7 @@ void ghostscript_interface::gs_generate_graphics_file(const PageNumber& page, co
PSfile.close();
// Step 2: Call GS with the File
- QFile::remove(filename.toLatin1());
+ QFile::remove(filename);
KProcess proc;
proc.setOutputChannelMode(KProcess::SeparateChannels);
QStringList argus;
diff --git a/generators/dvi/special.cpp b/generators/dvi/special.cpp
index 522c017..d87dd74 100644
--- a/generators/dvi/special.cpp
+++ b/generators/dvi/special.cpp
@@ -115,20 +115,20 @@ QColor dviRenderer::parseColorSpecification(const QString& colorSpec)
namedColors[QStringLiteral("WildStrawberry")] = QColor( (int)(255.0*1), (int)(255.0*0.04), (int)(255.0*0.61));
}
- QString specType = colorSpec.section(' ', 0, 0);
+ QString specType = colorSpec.section(QLatin1Char(' '), 0, 0);
if (specType.indexOf(QStringLiteral("rgb"), 0, Qt::CaseInsensitive) == 0) {
bool ok;
- double r = colorSpec.section(' ', 1, 1).toDouble(&ok);
+ double r = colorSpec.section(QLatin1Char(' '), 1, 1).toDouble(&ok);
if ((ok == false) || (r < 0.0) || (r > 1.0))
return QColor();
- double g = colorSpec.section(' ', 2, 2).toDouble(&ok);
+ double g = colorSpec.section(QLatin1Char(' '), 2, 2).toDouble(&ok);
if ((ok == false) || (g < 0.0) || (g > 1.0))
return QColor();
- double b = colorSpec.section(' ', 3, 3).toDouble(&ok);
+ double b = colorSpec.section(QLatin1Char(' '), 3, 3).toDouble(&ok);
if ((ok == false) || (b < 0.0) || (b > 1.0))
return QColor();
@@ -138,15 +138,15 @@ QColor dviRenderer::parseColorSpecification(const QString& colorSpec)
if (specType.indexOf(QStringLiteral("hsb"), 0, Qt::CaseInsensitive) == 0) {
bool ok;
- double h = colorSpec.section(' ', 1, 1).toDouble(&ok);
+ double h = colorSpec.section(QLatin1Char(' '), 1, 1).toDouble(&ok);
if ((ok == false) || (h < 0.0) || (h > 1.0))
return QColor();
- double s = colorSpec.section(' ', 2, 2).toDouble(&ok);
+ double s = colorSpec.section(QLatin1Char(' '), 2, 2).toDouble(&ok);
if ((ok == false) || (s < 0.0) || (s > 1.0))
return QColor();
- double b = colorSpec.section(' ', 3, 3).toDouble(&ok);
+ double b = colorSpec.section(QLatin1Char(' '), 3, 3).toDouble(&ok);
if ((ok == false) || (b < 0.0) || (b > 1.0))
return QColor();
@@ -156,19 +156,19 @@ QColor dviRenderer::parseColorSpecification(const QString& colorSpec)
if (specType.indexOf(QStringLiteral("cmyk"), 0, Qt::CaseInsensitive) == 0) {
bool ok;
- double c = colorSpec.section(' ', 1, 1).toDouble(&ok);
+ double c = colorSpec.section(QLatin1Char(' '), 1, 1).toDouble(&ok);
if ((ok == false) || (c < 0.0) || (c > 1.0))
return QColor();
- double m = colorSpec.section(' ', 2, 2).toDouble(&ok);
+ double m = colorSpec.section(QLatin1Char(' '), 2, 2).toDouble(&ok);
if ((ok == false) || (m < 0.0) || (m > 1.0))
return QColor();
- double y = colorSpec.section(' ', 3, 3).toDouble(&ok);
+ double y = colorSpec.section(QLatin1Char(' '), 3, 3).toDouble(&ok);
if ((ok == false) || (y < 0.0) || (y > 1.0))
return QColor();
- double k = colorSpec.section(' ', 3, 3).toDouble(&ok);
+ double k = colorSpec.section(QLatin1Char(' '), 3, 3).toDouble(&ok);
if ((ok == false) || (k < 0.0) || (k > 1.0))
return QColor();
@@ -189,7 +189,7 @@ QColor dviRenderer::parseColorSpecification(const QString& colorSpec)
if (specType.indexOf(QStringLiteral("gray"), 0, Qt::CaseInsensitive) == 0) {
bool ok;
- double g = colorSpec.section(' ', 1, 1).toDouble(&ok);
+ double g = colorSpec.section(QLatin1Char(' '), 1, 1).toDouble(&ok);
if ((ok == false) || (g < 0.0) || (g > 1.0))
return QColor();
@@ -209,7 +209,7 @@ void dviRenderer::color_special(const QString& _cp)
{
QString const cp = _cp.trimmed();
- QString command = cp.section(' ', 0, 0);
+ QString command = cp.section(QLatin1Char(' '), 0, 0);
if (command == QLatin1String("pop")) {
// Take color off the stack
@@ -223,7 +223,7 @@ void dviRenderer::color_special(const QString& _cp)
if (command == QLatin1String("push")) {
// Get color specification
- const QColor col = parseColorSpecification(cp.section(' ', 1));
+ const QColor col = parseColorSpecification(cp.section(QLatin1Char(' '), 1));
// Set color
if (col.isValid())
colorStack.push(col);
@@ -247,7 +247,7 @@ void dviRenderer::color_special(const QString& _cp)
void dviRenderer::html_href_special(const QString& _cp)
{
QString cp = _cp;
- cp.truncate(cp.indexOf('"'));
+ cp.truncate(cp.indexOf(QLatin1Char('"')));
#ifdef DEBUG_SPECIAL
qCDebug(OkularDviDebug) << "HTML-special, href " << cp.toLatin1();
@@ -285,10 +285,10 @@ void dviRenderer::source_special(const QString& cp)
void parse_special_argument(const QString& strg, const char* argument_name, int* variable)
{
- int index = strg.indexOf(argument_name);
+ int index = strg.indexOf(QString::fromLocal8Bit(argument_name));
if (index >= 0) {
QString tmp = strg.mid(index + strlen(argument_name));
- index = tmp.indexOf(' ');
+ index = tmp.indexOf(QLatin1Char(' '));
if (index >= 0)
tmp.truncate(index);
@@ -301,7 +301,7 @@ void parse_special_argument(const QString& strg, const char* argument_name, int*
// Maybe we should open a dialog here.
qCCritical(OkularDviDebug) << i18n("Malformed parameter in the epsf special command.\n"
"Expected a float to follow %1 in %2",
- argument_name, strg) << endl;
+ QString::fromLocal8Bit(argument_name), strg) << endl;
}
}
@@ -320,13 +320,13 @@ void dviRenderer::epsf_special(const QString& cp)
// (already the simplified() above is wrong). If you have
// files like this, go away.
QString EPSfilename_orig = include_command;
- EPSfilename_orig.truncate(EPSfilename_orig.indexOf(' '));
+ EPSfilename_orig.truncate(EPSfilename_orig.indexOf(QLatin1Char(' ')));
// Strip enclosing quotation marks which are included by some LaTeX
// macro packages (but not by others). This probably means that
// graphic files are no longer found if the filename really does
// contain quotes, but we don't really care that much.
- if ((EPSfilename_orig.at(0) == '\"') && (EPSfilename_orig.at(EPSfilename_orig.length()-1) == '\"')) {
+ if ((EPSfilename_orig.at(0) == QLatin1Char('\"')) && (EPSfilename_orig.at(EPSfilename_orig.length()-1) == QLatin1Char('\"'))) {
EPSfilename_orig = EPSfilename_orig.mid(1,EPSfilename_orig.length()-2);
}
QString EPSfilename = ghostscript_interface::locateEPSfile(EPSfilename_orig, baseURL);
@@ -341,7 +341,7 @@ void dviRenderer::epsf_special(const QString& cp)
int angle = 0;
// just to avoid ambiguities; the filename could contain keywords
- include_command = include_command.mid(include_command.indexOf(' '));
+ include_command = include_command.mid(include_command.indexOf(QLatin1Char(' ')));
parse_special_argument(include_command, "llx=", &llx);
parse_special_argument(include_command, "lly=", &lly);
@@ -467,12 +467,12 @@ void dviRenderer::TPIC_addPath_special(const QString& cp)
// Adds a point to the path list
QString cp_noWhiteSpace = cp.trimmed();
bool ok;
- float xKoord = cp_noWhiteSpace.section(' ', 0, 0).toFloat(&ok);
+ float xKoord = cp_noWhiteSpace.section(QLatin1Char(' '), 0, 0).toFloat(&ok);
if (ok == false) {
printErrorMsgForSpecials( QStringLiteral("TPIC special; cannot parse first argument in 'pn %1'.").arg(cp) );
return;
}
- float yKoord = cp_noWhiteSpace.section(' ', 1, 1).toFloat(&ok);
+ float yKoord = cp_noWhiteSpace.section(QLatin1Char(' '), 1, 1).toFloat(&ok);
if (ok == false) {
printErrorMsgForSpecials( QStringLiteral("TPIC special; cannot parse second argument in 'pn %1'.").arg(cp) );
return;
@@ -511,7 +511,7 @@ void dviRenderer::TPIC_setPen_special(const QString& cp)
void dviRenderer::applicationDoSpecial(char *cp)
{
- QString special_command(cp);
+ QString special_command = QString::fromLocal8Bit(cp);
// First come specials which is only interpreted during rendering,
// and NOT during the prescan phase
@@ -650,7 +650,7 @@ void dviRenderer::applicationDoSpecial(char *cp)
// line break is encountered)
if (special_command.startsWith(QLatin1String("ps:SDict begin [")) && special_command.endsWith(QLatin1String(" pdfmark end"))) {
if (!currentlyDrawnPage->hyperLinkList.isEmpty()) {
- QString targetName = special_command.section('(', 1, 1).section(')', 0, 0);
+ QString targetName = special_command.section(QLatin1Char('('), 1, 1).section(QLatin1Char(')'), 0, 0);
QVector<Hyperlink>::iterator it;
for( it = currentlyDrawnPage->hyperLinkList.begin(); it != currentlyDrawnPage->hyperLinkList.end(); ++it )
if (it->linkText == QLatin1String("glopglyph"))
@@ -667,7 +667,7 @@ void dviRenderer::applicationDoSpecial(char *cp)
if (special_command.startsWith(QLatin1String("ps: gsave currentpoint currentpoint translate ")) &&
special_command.endsWith(QLatin1String(" neg rotate neg exch neg exch translate")) ) {
bool ok;
- double angle = special_command.section(' ', 5, 5).toDouble(&ok);
+ double angle = special_command.section(QLatin1Char(' '), 5, 5).toDouble(&ok);
if (ok == true) {
int x = ((int) ((currinf.data.dvi_h) / (shrinkfactor * 65536)));
int y = currinf.data.pxl_v;
diff --git a/generators/dvi/vf.cpp b/generators/dvi/vf.cpp
index da990fc..3423816 100644
--- a/generators/dvi/vf.cpp
+++ b/generators/dvi/vf.cpp
@@ -115,7 +115,7 @@ void TeXFontDefinition::read_VF_index()
double enlargement_factor = double(scale)/(1<<20) * enlargement;
// TeXFontDefinition *newfontp = font_pool->appendx(fontname, checksum, (quint32)(scaled_size_in_DVI_units*enlargement_factor), enlargement_factor);
- TeXFontDefinition *newfontp = font_pool->appendx(fontname, checksum, (quint32)((double(scale)/(1<<20))*scaled_size_in_DVI_units), enlargement_factor);
+ TeXFontDefinition *newfontp = font_pool->appendx(QString::fromLocal8Bit(fontname), checksum, (quint32)((double(scale)/(1<<20))*scaled_size_in_DVI_units), enlargement_factor);
// Insert font in dictionary and make sure the dictionary is big
// enough.