[PC-BSD Commits] r2110 - pcbsd/trunk/PBIThumbnailCreator

svn at pcbsd.org svn at pcbsd.org
Tue Jun 17 10:46:41 PDT 2008


Author: kris
Date: 2008-06-17 10:46:40 -0700 (Tue, 17 Jun 2008)
New Revision: 2110

Modified:
   pcbsd/trunk/PBIThumbnailCreator/CMakeLists.txt
   pcbsd/trunk/PBIThumbnailCreator/pbicreator.cpp
Log:

Updated the PBIThumbnailCreator to KDE / QT4, still doesn't work though, probably needs more fixes relating to KDE4



Modified: pcbsd/trunk/PBIThumbnailCreator/CMakeLists.txt
===================================================================
--- pcbsd/trunk/PBIThumbnailCreator/CMakeLists.txt	2008-06-17 16:26:29 UTC (rev 2109)
+++ pcbsd/trunk/PBIThumbnailCreator/CMakeLists.txt	2008-06-17 17:46:40 UTC (rev 2110)
@@ -1,25 +1,32 @@
 PROJECT (PBI_ThumbnailCreator)
+set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
 cmake_minimum_required(VERSION 2.4.0)
 
-find_package(Qt3 REQUIRED)
-find_package(KDE3 REQUIRED)
+find_package(Qt4 REQUIRED)
+find_package(KDE4 REQUIRED)
+include(KDE4Defaults)
+include(MacroLibrary)
 
-add_definitions(${QT_DEFINITIONS} ${KDE3_DEFINITIONS})
+add_definitions (${QT_DEFINITIONS} ${QT_QTDBUS_DEFINITIONS} ${KDE4_DEFINITIONS})
+add_definitions (-DQT3_SUPPORT -DQT3_SUPPORT_WARNINGS -DQT_STL)
 
-link_directories(${KDE3_LIB_DIR})
-include_directories(${KDE3_INCLUDE_DIR} ${QT_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}  ${KDE4_ENABLE_EXCEPTIONS}")
 
+link_directories(${KDE4_LIB_DIR})
+#include_directories(${KDE4_INCLUDE_DIR} ${QT_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
+include_directories (${QDBUS_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES})
+
 set (pbithumbnail_SRCS
  pbicreator.cpp
 )
 
-kde3_automoc(${pbithumbnail_SRCS})
+#kde4_automoc(${pbithumbnail_SRCS})
 
-kde3_add_kpart(pbithumbnail ${pbithumbnail_SRCS})
+kde4_add_plugin(pbithumbnail ${pbithumbnail_SRCS})
 
-target_link_libraries(pbithumbnail ${QT_AND_KDECORE_LIBRARIES} ${KDE3_KIO_LIBS})
+target_link_libraries(pbithumbnail ${QT_AND_KDECORE_LIBRARIES} ${KDE4_KIO_LIBS})
 
 ### INSTALL ###
 
-INSTALL_TARGETS(/lib/kde3 pbithumbnail)
+INSTALL_TARGETS(/lib/kde4 pbithumbnail)
 INSTALL_FILES(/share/services FILES pbithumbnail.desktop)

Modified: pcbsd/trunk/PBIThumbnailCreator/pbicreator.cpp
===================================================================
--- pcbsd/trunk/PBIThumbnailCreator/pbicreator.cpp	2008-06-17 16:26:29 UTC (rev 2109)
+++ pcbsd/trunk/PBIThumbnailCreator/pbicreator.cpp	2008-06-17 17:46:40 UTC (rev 2110)
@@ -22,10 +22,11 @@
  *   OTHER DEALINGS IN THE SOFTWARE.                                       *
  ***************************************************************************/
 
+#include <kapplication.h>
 #include <qimage.h>
-#include <qfile.h>
-#include <kapplication.h>
-
+#include <qiodevice.h>
+#include <QTextStream>
+#include <kfile.h>
 #include "pbicreator.h"
 
 extern "C"
@@ -46,6 +47,7 @@
    QImage image;
    uint startPos = 0;
    uint finishPos = 0;
+   char *c;
 
    QString line;
    while (!stream.atEnd())
@@ -56,19 +58,22 @@
 
          if (line == "__PBI_ARCHIVE__")
          {
-            file.at(startPos);
-            QByteArray ba(finishPos - startPos);
+            file.seek(startPos);
+            QByteArray ba;
+            ba.resize(finishPos - startPos);
             uint i = 0;
-            while (file.at() < finishPos)
+            while (file.pos() < finishPos)
             {
-               ba[i] = file.getch();
+               //ba[i] = file.getChar();
+               file.getChar(c);
+               ba[i] = *c;
                i++;
             }
             file.close();
             img.loadFromData(ba);
             return true;
          }
-         finishPos = file.at();
+         finishPos = file.pos();
       }
       
       line = stream.readLine();
@@ -76,7 +81,7 @@
       if (line == "__PBI_ICON__")
       {
          inIcon = true;
-         startPos = file.at();
+         startPos = file.pos();
       }
       else if (line == "__PBI_ICON__") return false; //If we got here, there isn't a custom icon. Bail out ASAP.
    }



More information about the Commits mailing list