Compile DVI, TIFF and XPS generators

This commit is contained in:
Fabio D'Urso 2014-08-24 22:52:23 +02:00
parent 0b662faf35
commit 75c8acee60
9 changed files with 27 additions and 32 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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;

View file

@ -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);

View file

@ -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

View file

@ -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 );

View file

@ -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 )
{

View file

@ -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} )

View file

@ -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;
}