summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio D'Urso <fabiodurso@hotmail.it>2014-08-24 20:52:23 (GMT)
committerFabio D'Urso <fabiodurso@hotmail.it>2014-08-24 21:13:45 (GMT)
commit75c8acee60f5ca3d780df86e994b1a84fbd78d36 (patch)
treeed072ecd0c5258ef67ecd0ef4bbe0e30da03a493
parent0b662faf35ffe021405a1f73098e3cd76cd10b75 (diff)
Compile DVI, TIFF and XPS generators
-rw-r--r--generators/CMakeLists.txt10
-rw-r--r--generators/dvi/CMakeLists.txt4
-rw-r--r--generators/dvi/TeXFontDefinition.cpp4
-rw-r--r--generators/dvi/TeXFont_PFB.cpp2
-rw-r--r--generators/dvi/TeXFont_PK.cpp2
-rw-r--r--generators/dvi/dviRenderer_prescan.cpp2
-rw-r--r--generators/dvi/generator_dvi.cpp2
-rw-r--r--generators/tiff/CMakeLists.txt8
-rw-r--r--generators/xps/generator_xps.cpp25
9 files changed, 27 insertions, 32 deletions
diff --git a/generators/CMakeLists.txt b/generators/CMakeLists.txt
index 7c29ef8..330a8bb 100644
--- a/generators/CMakeLists.txt
+++ b/generators/CMakeLists.txt
@@ -100,13 +100,13 @@ endif(CHM_FOUND)
# add_subdirectory(djvu)
#endif(DJVULIBRE_FOUND)
-#add_subdirectory(dvi)
+add_subdirectory(dvi)
-#if(TIFF_FOUND)
-# add_subdirectory(tiff)
-#endif(TIFF_FOUND)
+if(TIFF_FOUND)
+ add_subdirectory(tiff)
+endif(TIFF_FOUND)
-#add_subdirectory(xps)
+add_subdirectory(xps)
#add_subdirectory(ooo)
diff --git a/generators/dvi/CMakeLists.txt b/generators/dvi/CMakeLists.txt
index e95c9ca..1703565 100644
--- a/generators/dvi/CMakeLists.txt
+++ b/generators/dvi/CMakeLists.txt
@@ -46,9 +46,9 @@ set(okularGenerator_dvi_SRCS
)
-kde4_add_plugin(okularGenerator_dvi ${okularGenerator_dvi_SRCS})
+add_library(okularGenerator_dvi MODULE ${okularGenerator_dvi_SRCS})
-target_link_libraries(okularGenerator_dvi okularcore ${KDE4_KIO_LIBS} ${MATH_LIB})
+target_link_libraries(okularGenerator_dvi okularcore)
if (FREETYPE_FOUND)
target_link_libraries(okularGenerator_dvi ${FREETYPE_LIBRARIES})
endif (FREETYPE_FOUND)
diff --git a/generators/dvi/TeXFontDefinition.cpp b/generators/dvi/TeXFontDefinition.cpp
index b3c72bc..46d2507 100644
--- a/generators/dvi/TeXFontDefinition.cpp
+++ b/generators/dvi/TeXFontDefinition.cpp
@@ -96,13 +96,13 @@ void TeXFontDefinition::fontNameReceiver(const QString& fname)
fullEncodingName.clear();
#endif
- file = fopen(QFile::encodeName(filename), "r");
+ file = fopen(QFile::encodeName(filename).constData(), "r");
// Check if the file could be opened. If not, try to find the file
// 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);
- file = fopen( QFile::encodeName(filename_test), "r");
+ file = fopen( QFile::encodeName(filename_test).constData(), "r");
if (file == 0) {
kError(kvs::dvi) << i18n("Cannot find font %1, file %2.", fontname, filename) << endl;
return;
diff --git a/generators/dvi/TeXFont_PFB.cpp b/generators/dvi/TeXFont_PFB.cpp
index 6b27093..92745de 100644
--- a/generators/dvi/TeXFont_PFB.cpp
+++ b/generators/dvi/TeXFont_PFB.cpp
@@ -36,7 +36,7 @@ TeXFont_PFB::TeXFont_PFB(TeXFontDefinition *parent, fontEncoding *enc, double sl
fatalErrorInFontLoading = false;
- int error = FT_New_Face( parent->font_pool->FreeType_library, parent->filename.toLocal8Bit(), 0, &face );
+ int error = FT_New_Face( parent->font_pool->FreeType_library, parent->filename.toLocal8Bit().constData(), 0, &face );
if ( error == FT_Err_Unknown_File_Format ) {
errorMessage = i18n("The font file %1 could be opened and read, but its font format is unsupported.", parent->filename);
diff --git a/generators/dvi/TeXFont_PK.cpp b/generators/dvi/TeXFont_PK.cpp
index fd91fe0..b6fdbf5 100644
--- a/generators/dvi/TeXFont_PK.cpp
+++ b/generators/dvi/TeXFont_PK.cpp
@@ -85,7 +85,7 @@ TeXFont_PK::TeXFont_PK(TeXFontDefinition *parent)
for(unsigned int i=0; i<TeXFontDefinition::max_num_of_chars_in_font; i++)
characterBitmaps[i] = 0;
- file = fopen(QFile::encodeName(parent->filename), "r");
+ file = fopen(QFile::encodeName(parent->filename).constData(), "r");
if (file == 0)
kError(kvs::dvi) << i18n("Cannot open font file %1.", parent->filename) << endl;
#ifdef DEBUG_PK
diff --git a/generators/dvi/dviRenderer_prescan.cpp b/generators/dvi/dviRenderer_prescan.cpp
index e54ed41..bfcebb1 100644
--- a/generators/dvi/dviRenderer_prescan.cpp
+++ b/generators/dvi/dviRenderer_prescan.cpp
@@ -167,7 +167,7 @@ void dviRenderer::prescan_embedPS(char *cp, quint8 *beginningOfSpecialCommand)
command_pointer[0] = XXX4;
command_pointer++;
writeUINT32(PS.length());
- memcpy(newDVI.data()+(beginningOfSpecialCommand-dviFile->dvi_Data())+5, PS.toLatin1(), PS.length() );
+ memcpy(newDVI.data()+(beginningOfSpecialCommand-dviFile->dvi_Data())+5, PS.toLatin1().constData(), PS.length() );
memcpy(newDVI.data()+(beginningOfSpecialCommand-dviFile->dvi_Data())+lengthOfNewSpecial, beginningOfSpecialCommand+lengthOfOldSpecial,
dviFile->size_of_file-(beginningOfSpecialCommand-dviFile->dvi_Data())-lengthOfOldSpecial );
diff --git a/generators/dvi/generator_dvi.cpp b/generators/dvi/generator_dvi.cpp
index 611393d..8205e2e 100644
--- a/generators/dvi/generator_dvi.cpp
+++ b/generators/dvi/generator_dvi.cpp
@@ -197,7 +197,7 @@ QLinkedList<Okular::ObjectRect*> DviGenerator::generateDviLinks( const dviPageIn
}
else
{
- okuLink = new Okular::BrowseAction( dviLink.linkText );
+ okuLink = new Okular::BrowseAction( QUrl::fromUserInput( dviLink.linkText ) );
}
if ( okuLink )
{
diff --git a/generators/tiff/CMakeLists.txt b/generators/tiff/CMakeLists.txt
index bab056f..f7bcc3a 100644
--- a/generators/tiff/CMakeLists.txt
+++ b/generators/tiff/CMakeLists.txt
@@ -10,11 +10,8 @@ set(okularGenerator_tiff_SRCS
generator_tiff.cpp
)
-
-kde4_add_plugin(okularGenerator_tiff ${okularGenerator_tiff_SRCS})
-
-target_link_libraries(okularGenerator_tiff okularcore ${TIFF_LIBRARIES} ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY})
-
+add_library(okularGenerator_tiff MODULE ${okularGenerator_tiff_SRCS})
+target_link_libraries(okularGenerator_tiff okularcore ${TIFF_LIBRARIES})
install(TARGETS okularGenerator_tiff DESTINATION ${PLUGIN_INSTALL_DIR})
@@ -22,4 +19,3 @@ install(TARGETS okularGenerator_tiff DESTINATION ${PLUGIN_INSTALL_DIR})
install( FILES libokularGenerator_tiff.desktop okularTiff.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
install( PROGRAMS okularApplication_tiff.desktop active-documentviewer_tiff.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
-
diff --git a/generators/xps/generator_xps.cpp b/generators/xps/generator_xps.cpp
index 2f32666..bdc563a 100644
--- a/generators/xps/generator_xps.cpp
+++ b/generators/xps/generator_xps.cpp
@@ -80,23 +80,22 @@ static int hex2int(char hex)
}
// Modified from Qt4
-static QColor hexToRgba(const char *name)
+static QColor hexToRgba(const QByteArray &name)
{
- if(name[0] != '#')
+ const int len = name.length();
+ if (len == 0 || name[0] != '#')
return QColor();
- name++; // eat the leading '#'
- int len = qstrlen(name);
int r, g, b;
int a = 255;
- if (len == 6) {
- r = (hex2int(name[0]) << 4) + hex2int(name[1]);
- g = (hex2int(name[2]) << 4) + hex2int(name[3]);
- b = (hex2int(name[4]) << 4) + hex2int(name[5]);
- } else if (len == 8) {
- a = (hex2int(name[0]) << 4) + hex2int(name[1]);
- r = (hex2int(name[2]) << 4) + hex2int(name[3]);
- g = (hex2int(name[4]) << 4) + hex2int(name[5]);
- b = (hex2int(name[6]) << 4) + hex2int(name[7]);
+ if (len == 7) {
+ r = (hex2int(name[1]) << 4) + hex2int(name[2]);
+ g = (hex2int(name[3]) << 4) + hex2int(name[4]);
+ b = (hex2int(name[5]) << 4) + hex2int(name[6]);
+ } else if (len == 9) {
+ a = (hex2int(name[1]) << 4) + hex2int(name[2]);
+ r = (hex2int(name[3]) << 4) + hex2int(name[4]);
+ g = (hex2int(name[5]) << 4) + hex2int(name[6]);
+ b = (hex2int(name[7]) << 4) + hex2int(name[8]);
} else {
r = g = b = -1;
}