diff --git a/CMakeLists.txt b/CMakeLists.txt index 74f725fd1..b81fbfaa2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,11 @@ add_subdirectory( generators ) include(OkularConfigureChecks.cmake) +if(NOT WIN32) + set(MATH_LIB m) +else(NOT WIN32) + set(MATH_LIB) +endif(NOT WIN32) include_directories( ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/okular/ui/painter_agg2/ @@ -75,7 +80,7 @@ IF(APPLE) SET(OKULAR_IOKIT "-framework IOKit" CACHE STRING "Apple IOKit framework") ENDIF(APPLE) -target_link_libraries(okularcore ${OKULAR_IOKIT} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBRARY} ${KDE4_KDEPRINT_LIBS} ${KDE4_PHONONCORE_LIBRARY} m ) +target_link_libraries(okularcore ${OKULAR_IOKIT} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBRARY} ${KDE4_KDEPRINT_LIBS} ${KDE4_PHONONCORE_LIBRARY} ${MATH_LIB}) install(TARGETS okularcore DESTINATION ${LIB_INSTALL_DIR} ) @@ -138,7 +143,7 @@ kde4_automoc(${okularpart_SRCS}) kde4_add_plugin(okularpart WITH_PREFIX ${okularpart_SRCS}) -target_link_libraries(okularpart okularcore ${KDE4_KPARTS_LIBS} ${KDE4_KDEPRINT_LIBS} ${KDE4_KNEWSTUFF_LIBS} ${KDE4_KHTML_LIBS} m ) +target_link_libraries(okularpart okularcore ${KDE4_KPARTS_LIBS} ${KDE4_KDEPRINT_LIBS} ${KDE4_KNEWSTUFF_LIBS} ${KDE4_KHTML_LIBS} ${MATH_LIB}) if ( X11_Xrender_FOUND ) target_link_libraries( okularpart ${X11_Xrender_LIB} ) endif ( X11_Xrender_FOUND ) diff --git a/core/area.h b/core/area.h index 50a45ebd5..910f7dbdf 100644 --- a/core/area.h +++ b/core/area.h @@ -492,7 +492,7 @@ template class RegularArea : public QList< }; template -RegularArea::~RegularArea() +RegularArea::~RegularArea() { int size = this->count(); for ( int i = 0; i < size; ++i ) diff --git a/core/generator.h b/core/generator.h index 46464f606..e7ef1cd61 100644 --- a/core/generator.h +++ b/core/generator.h @@ -23,9 +23,10 @@ #include +// KDE_EXPORT is correct here - the function needs to be exported every time #define OKULAR_EXPORT_PLUGIN( classname ) \ extern "C" { \ - OKULAR_EXPORT Okular::Generator* create_plugin() { return new classname(); } \ + KDE_EXPORT Okular::Generator* create_plugin() { return new classname(); } \ } class KAboutData; diff --git a/core/observer.cpp b/core/observer.cpp index 6a4a95e53..e3d8655e1 100644 --- a/core/observer.cpp +++ b/core/observer.cpp @@ -12,6 +12,10 @@ using namespace Okular; +DocumentObserver::DocumentObserver() +{ +} + DocumentObserver::~DocumentObserver() { } diff --git a/core/observer.h b/core/observer.h index 75c083e5b..6af9a954b 100644 --- a/core/observer.h +++ b/core/observer.h @@ -52,6 +52,7 @@ class Page; class OKULAR_EXPORT DocumentObserver { public: + DocumentObserver(); /** * Destroys the document observer. */ diff --git a/core/okular_export.h b/core/okular_export.h index cfdab51fe..d517915c7 100644 --- a/core/okular_export.h +++ b/core/okular_export.h @@ -14,7 +14,7 @@ #include -#if defined Q_OS_WIN +#if defined _WIN32 || defined _WIN64 #ifndef OKULAR_EXPORT # ifdef MAKE_OKULARCORE_LIB # define OKULAR_EXPORT KDE_EXPORT diff --git a/core/utils.cpp b/core/utils.cpp index d95392594..0fa5ecb3f 100644 --- a/core/utils.cpp +++ b/core/utils.cpp @@ -137,5 +137,15 @@ double Utils::dpiY() return err == CGDisplayNoErr ? y : 72.0; } #else -#error "Not yet contributed" +#include + +double Utils::dpiX() +{ + return QDesktopWidget().physicalDpiX(); +} + +double Utils::dpiY() +{ + return QDesktopWidget().physicalDpiY(); +} #endif diff --git a/generators/dvi/CMakeLists.txt b/generators/dvi/CMakeLists.txt index b94aeef04..9390b3481 100644 --- a/generators/dvi/CMakeLists.txt +++ b/generators/dvi/CMakeLists.txt @@ -25,7 +25,7 @@ set(okularGenerator_dvi_SRCS dviFile.cpp dviPageInfo.cpp psgs.cpp - psheader.cpp +# psheader.cpp # already included in psgs.cpp glyph.cpp TeXFont.cpp TeXFontDefinition.cpp @@ -49,7 +49,7 @@ kde4_automoc(${okularGenerator_dvi_SRCS}) kde4_add_plugin(okularGenerator_dvi WITH_PREFIX ${okularGenerator_dvi_SRCS}) -target_link_libraries(okularGenerator_dvi okularcore m ${KDE4_KDEPRINT_LIBS} ) +target_link_libraries(okularGenerator_dvi okularcore ${KDE4_KDEPRINT_LIBS} ${MATH_LIB} ) if (FREETYPE_FOUND) target_link_libraries(okularGenerator_dvi ${FREETYPE_LIBRARIES}) endif (FREETYPE_FOUND) diff --git a/generators/dvi/TeXFont_PK.cpp b/generators/dvi/TeXFont_PK.cpp index 975b4934c..cff9c4df2 100644 --- a/generators/dvi/TeXFont_PK.cpp +++ b/generators/dvi/TeXFont_PK.cpp @@ -124,7 +124,7 @@ glyph* TeXFont_PK::getGlyph(quint16 ch, bool generateCharacterPixmap, const QCol } // This is the address of the glyph that will be returned. - struct glyph *g = glyphtable+ch; + class glyph *g = glyphtable+ch; // Check if the glyph is loaded. If not, load it now. if (characterBitmaps[ch] == 0) { @@ -471,7 +471,7 @@ void TeXFont_PK::read_PK_char(unsigned int ch) int row_bit_pos; bool paint_switch; quint32* cp; - register struct glyph *g; + register class glyph *g; register FILE *fp = file; long fpwidth; quint32 word = 0; diff --git a/generators/dvi/TeXFont_PK.h b/generators/dvi/TeXFont_PK.h index 5d38dbd06..805d8a927 100644 --- a/generators/dvi/TeXFont_PK.h +++ b/generators/dvi/TeXFont_PK.h @@ -19,7 +19,7 @@ class TeXFont_PK : public TeXFont { // open font file or NULL FILE* file; - class bitmap *characterBitmaps[TeXFontDefinition::max_num_of_chars_in_font]; + struct bitmap *characterBitmaps[TeXFontDefinition::max_num_of_chars_in_font]; // For use by PK-decryption routines. I don't understand what these // are good for -- Stefan Kebekus diff --git a/generators/dvi/TeXFont_TFM.cpp b/generators/dvi/TeXFont_TFM.cpp index f788ca9f6..decd011ae 100644 --- a/generators/dvi/TeXFont_TFM.cpp +++ b/generators/dvi/TeXFont_TFM.cpp @@ -131,7 +131,7 @@ glyph* TeXFont_TFM::getGlyph(quint16 characterCode, bool generateCharacterPixmap } // This is the address of the glyph that will be returned. - struct glyph *g = glyphtable+characterCode; + class glyph *g = glyphtable+characterCode; if ((generateCharacterPixmap == true) && ((g->shrunkenCharacter.isNull()) || (color != g->color)) ) { g->color = color; diff --git a/generators/fictionbook/CMakeLists.txt b/generators/fictionbook/CMakeLists.txt index c9b816e52..15ea03446 100644 --- a/generators/fictionbook/CMakeLists.txt +++ b/generators/fictionbook/CMakeLists.txt @@ -16,7 +16,7 @@ kde4_automoc(${okularGenerator_fb_PART_SRCS}) kde4_add_plugin(okularGenerator_fb WITH_PREFIX ${okularGenerator_fb_PART_SRCS}) -target_link_libraries(okularGenerator_fb ${POPPLER_LIBRARY} okularcore ${KDE4_KDEPRINT_LIBS} m ) +target_link_libraries(okularGenerator_fb ${POPPLER_LIBRARY} okularcore ${KDE4_KDEPRINT_LIBS} ${MATH_LIB} ) install(TARGETS okularGenerator_fb DESTINATION ${PLUGIN_INSTALL_DIR}) diff --git a/generators/ooo/CMakeLists.txt b/generators/ooo/CMakeLists.txt index 059630365..a656bae8a 100644 --- a/generators/ooo/CMakeLists.txt +++ b/generators/ooo/CMakeLists.txt @@ -19,7 +19,7 @@ kde4_automoc(${okularGenerator_ooo_PART_SRCS}) kde4_add_plugin(okularGenerator_ooo WITH_PREFIX ${okularGenerator_ooo_PART_SRCS}) -target_link_libraries(okularGenerator_ooo ${POPPLER_LIBRARY} okularcore ${KDE4_KDEPRINT_LIBS} m ) +target_link_libraries(okularGenerator_ooo ${POPPLER_LIBRARY} okularcore ${KDE4_KDEPRINT_LIBS} ${MATH_LIB} ) install(TARGETS okularGenerator_ooo DESTINATION ${PLUGIN_INSTALL_DIR}) diff --git a/generators/plucker/CMakeLists.txt b/generators/plucker/CMakeLists.txt index 29dd23ea4..8244c2204 100644 --- a/generators/plucker/CMakeLists.txt +++ b/generators/plucker/CMakeLists.txt @@ -23,7 +23,7 @@ kde4_automoc(${okularGenerator_plucker_SRCS}) kde4_add_plugin(okularGenerator_plucker WITH_PREFIX ${okularGenerator_plucker_SRCS} ${qunpluck_SRCS}) -target_link_libraries(okularGenerator_plucker okularcore ${KDE4_KDEPRINT_LIBS} m ${JPEG_LIBRARY} ) +target_link_libraries(okularGenerator_plucker okularcore ${KDE4_KDEPRINT_LIBS} ${MATH_LIB} ${JPEG_LIBRARY} ) install(TARGETS okularGenerator_plucker DESTINATION ${PLUGIN_INSTALL_DIR}) diff --git a/generators/plucker/unpluck/unpluck.cpp b/generators/plucker/unpluck/unpluck.cpp index 4ab8f083e..2146f26b8 100644 --- a/generators/plucker/unpluck/unpluck.cpp +++ b/generators/plucker/unpluck/unpluck.cpp @@ -814,10 +814,10 @@ plkr_Document* plkr_OpenDoc crc = crc32 (crc, (const Bytef*)owner_id, owner_id_len); for (i = 0; i < 10; i++) { crc = crc32 (crc, (const Bytef*)owner_id, owner_id_len); - newdoc->owner_id_key[(i * 4) + 0] = (crc >> 24) & 0xFF; - newdoc->owner_id_key[(i * 4) + 1] = (crc >> 16) & 0xFF; - newdoc->owner_id_key[(i * 4) + 2] = (crc >> 8) & 0xFF; - newdoc->owner_id_key[(i * 4) + 3] = crc & 0xFF; + newdoc->owner_id_key[(i * 4) + 0] = (unsigned char)((crc >> 24) & 0xFF); + newdoc->owner_id_key[(i * 4) + 1] = (unsigned char)((crc >> 16) & 0xFF); + newdoc->owner_id_key[(i * 4) + 2] = (unsigned char)((crc >> 8) & 0xFF); + newdoc->owner_id_key[(i * 4) + 3] = (unsigned char)(crc & 0xFF); } } else { diff --git a/ui/annotationtools.h b/ui/annotationtools.h index d66859215..1ee32801e 100644 --- a/ui/annotationtools.h +++ b/ui/annotationtools.h @@ -19,7 +19,7 @@ class QPainter; class PageViewItem; namespace Okular { -struct Annotation; +class Annotation; class Page; } diff --git a/ui/pageview.h b/ui/pageview.h index 8251647d0..88463b83b 100644 --- a/ui/pageview.h +++ b/ui/pageview.h @@ -31,7 +31,7 @@ class KActionCollection; namespace Okular { class Document; -struct Annotation; +class Annotation; } class PageViewPrivate; diff --git a/ui/pageviewutils.cpp b/ui/pageviewutils.cpp index 2be6b2a7f..1750bdf8b 100644 --- a/ui/pageviewutils.cpp +++ b/ui/pageviewutils.cpp @@ -356,8 +356,9 @@ ToolBarButton::ToolBarButton( QWidget * parent, const ToolBarItem & item ) static const int toolBarGridSize = 40; static const int toolBarRBMargin = 2; -struct ToolBarPrivate +class ToolBarPrivate { +public: ToolBarPrivate( PageViewToolBar * qq ) : q( qq ) { diff --git a/ui/presentationwidget.cpp b/ui/presentationwidget.cpp index a0f14f68d..613c1543b 100644 --- a/ui/presentationwidget.cpp +++ b/ui/presentationwidget.cpp @@ -572,7 +572,7 @@ void PresentationWidget::overlayClick( const QPoint & position ) return; // compute angle relative to indicator (note coord transformation) - float angle = 0.5 + 0.5 * atan2( -xPos, -yPos ) / M_PI; + float angle = 0.5 + 0.5 * atan2( (double)-xPos, (double)-yPos ) / M_PI; int pageIndex = (int)( angle * ( m_frames.count() - 1 ) + 0.5 ); // go to selected page diff --git a/ui/presentationwidget.h b/ui/presentationwidget.h index 3621b9518..7d782bc69 100644 --- a/ui/presentationwidget.h +++ b/ui/presentationwidget.h @@ -22,11 +22,11 @@ class QToolBar; class QTimer; class KActionCollection; class AnnotatorEngine; -class PresentationFrame; +struct PresentationFrame; class PresentationSearchBar; namespace Okular { -struct Annotation; +class Annotation; class Document; class Page; class Link; diff --git a/ui/thumbnaillist.cpp b/ui/thumbnaillist.cpp index 1ba7ff198..bc04fe44b 100644 --- a/ui/thumbnaillist.cpp +++ b/ui/thumbnaillist.cpp @@ -507,7 +507,7 @@ ThumbnailWidget::ThumbnailWidget( QWidget * parent, const Okular::Document * doc void ThumbnailWidget::resizeFitWidth( int width ) { m_pixmapWidth = width - m_margin; - m_pixmapHeight = (int)round( m_page->ratio() * (double)m_pixmapWidth ); + m_pixmapHeight = lround( m_page->ratio() * (double)m_pixmapWidth ); setFixedSize( QSize( width, heightHint() ) ); }