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

svn at pcbsd.org svn at pcbsd.org
Wed Jul 16 08:33:48 PDT 2008


Author: tim
Date: 2008-07-16 08:33:47 -0700 (Wed, 16 Jul 2008)
New Revision: 2356

Modified:
   pcbsd/trunk/PBIThumbnailCreator/CMakeLists.txt
   pcbsd/trunk/PBIThumbnailCreator/pbicreator.cpp
   pcbsd/trunk/PBIThumbnailCreator/pbithumbnail.desktop
Log:
Fixed thumbnail creator with new KDE4 paths, and altered to work properly with Qt4. Now works again!

Modified: pcbsd/trunk/PBIThumbnailCreator/CMakeLists.txt
===================================================================
--- pcbsd/trunk/PBIThumbnailCreator/CMakeLists.txt	2008-07-16 15:15:29 UTC (rev 2355)
+++ pcbsd/trunk/PBIThumbnailCreator/CMakeLists.txt	2008-07-16 15:33:47 UTC (rev 2356)
@@ -29,5 +29,5 @@
 
 ### INSTALL ###
 
-INSTALL_TARGETS(/lib/kde4 pbithumbnail)
-INSTALL_FILES(/share/services FILES pbithumbnail.desktop)
+INSTALL_TARGETS(/kde4/lib/kde4 pbithumbnail)
+install(FILES pbithumbnail.desktop DESTINATION /usr/local/kde4/share/kde4/services)

Modified: pcbsd/trunk/PBIThumbnailCreator/pbicreator.cpp
===================================================================
--- pcbsd/trunk/PBIThumbnailCreator/pbicreator.cpp	2008-07-16 15:15:29 UTC (rev 2355)
+++ pcbsd/trunk/PBIThumbnailCreator/pbicreator.cpp	2008-07-16 15:33:47 UTC (rev 2356)
@@ -22,11 +22,10 @@
  *   OTHER DEALINGS IN THE SOFTWARE.                                       *
  ***************************************************************************/
 
-#include <kapplication.h>
-#include <qimage.h>
-#include <qiodevice.h>
+#include <QImage>
 #include <QTextStream>
-#include <kfile.h>
+#include <QFile>
+#include <kdebug.h>
 #include "pbicreator.h"
 
 extern "C"
@@ -40,14 +39,12 @@
 bool PBICreator::create(const QString &path, int, int, QImage &img)
 {
    QFile file(path);
-   if (!file.open(IO_ReadOnly)) return false;
+   if (!file.open(QIODevice::ReadOnly)) return false;
 
    QTextStream stream(&file);
    bool inIcon = false;
-   QImage image;
-   uint startPos = 0;
-   uint finishPos = 0;
-   char *c;
+   qint64 startPos = 0;
+   qint64 finishPos = 0;
 
    QString line;
    while (!stream.atEnd())
@@ -60,20 +57,14 @@
          {
             file.seek(startPos);
             QByteArray ba;
-            ba.resize(finishPos - startPos);
-            uint i = 0;
-            while (file.pos() < finishPos)
-            {
-               //ba[i] = file.getChar();
-               file.getChar(c);
-               ba[i] = *c;
-               i++;
-            }
+	    qint64 size = finishPos - startPos;
+            ba.resize(size);
+            ba = file.read(size);
             file.close();
             img.loadFromData(ba);
             return true;
          }
-         finishPos = file.pos();
+         finishPos = stream.pos();
       }
       
       line = stream.readLine();
@@ -81,7 +72,7 @@
       if (line == "__PBI_ICON__")
       {
          inIcon = true;
-         startPos = file.pos();
+         startPos = stream.pos();
       }
       else if (line == "__PBI_ICON__") return false; //If we got here, there isn't a custom icon. Bail out ASAP.
    }

Modified: pcbsd/trunk/PBIThumbnailCreator/pbithumbnail.desktop
===================================================================
--- pcbsd/trunk/PBIThumbnailCreator/pbithumbnail.desktop	2008-07-16 15:15:29 UTC (rev 2355)
+++ pcbsd/trunk/PBIThumbnailCreator/pbithumbnail.desktop	2008-07-16 15:33:47 UTC (rev 2356)
@@ -2,7 +2,8 @@
 Encoding=UTF-8
 Type=Service
 Name=PBI
-ServiceTypes=ThumbCreator
-MimeTypes=application/PC-BSD Installer
+X-KDE-ServiceTypes=ThumbCreator
+MimeType=application/pbi;
 X-KDE-Library=pbithumbnail
 CacheThumbnail=true
+IgnoreMaximumSize=true
\ No newline at end of file



More information about the Commits mailing list