kioslaves/thumbnail patch
Allen Winter
winter at kde.org
Tue Sep 4 23:43:33 BST 2007
On Tuesday 07 August 2007 11:37:32 am Matthew Woehlke wrote:
> Anyone want to comment before I apply this (and later, similar patches
> to kaddressbook, kbabel and ksim)?
>
Was this committed to kaddressbook, kbabel, ksim, and everywhere
else it may have been necessary? Well, not that we care about kbabel anymore.
> (Actually, if someone else could patch kaddressbook that would be great,
> as I currently don't build kdepim. I am also not subscribed to kde-pim,
> so please CC me if replying only to that list.)
>
> This is against kdebase/runtime/kioslaves/thumbnail:
>
> Index: textcreator.cpp
> ===================================================================
> --- textcreator.cpp (revision 697345)
> +++ textcreator.cpp (working copy)
> @@ -27,6 +27,35 @@
>
> #include "textcreator.h"
>
> +class FontSplitter {
> +public:
> + FontSplitter() {}
> + virtual ~FontSplitter() {}
> +
> +protected:
> + int m_width;
> + QSize m_itemSize;
> + QPixmap m_pixmap;
> +
> +public:
> + void setPixmap(const QPixmap &pixmap) { m_pixmap = pixmap; }
> + const QPixmap& pixmap() const { return m_pixmap; }
> +
> + void setItemSize(const QSize &size) { m_itemSize = size; }
> + const QSize& itemSize() const { return m_itemSize; }
> +
> + QRect coordinates(const QChar& ch) const {
> + int pos = (unsigned char)ch.toLatin1();
> + int numCols = m_pixmap.width() / m_itemSize.width();
> + if ( numCols == 0 )
> + return QRect();
> + int row = pos / numCols;
> + int col = pos % numCols;
> + return QRect( QPoint( col * m_itemSize.width(), row *
> m_itemSize.height() ),
> + m_itemSize );
> + }
> +};
> +
> extern "C"
> {
> KDE_EXPORT ThumbCreator *new_creator()
> @@ -52,7 +81,7 @@
> {
> if ( !m_splitter )
> {
> - m_splitter = new KPixmapSplitter;
> + m_splitter = new FontSplitter;
> QString pixmap = KStandardDirs::locate( "data",
> "konqueror/pics/thumbnailfont_7x4.png" );
> if ( !pixmap.isEmpty() )
> {
> Index: textcreator.h
> ===================================================================
> --- textcreator.h (revision 697345)
> +++ textcreator.h (working copy)
> @@ -23,7 +23,7 @@
> #include <QPixmap>
> #include <kio/thumbcreator.h>
>
> -class KPixmapSplitter;
> +class FontSplitter;
>
> class TextCreator : public ThumbCreator
> {
> @@ -34,7 +34,7 @@
> virtual Flags flags() const;
>
> private:
> - KPixmapSplitter *m_splitter;
> + FontSplitter *m_splitter;
> char *m_data;
> int m_dataSize;
> QPixmap m_pixmap;
>
--
KDEPIM Developer
I accept PayPal payments to awinterz at earthlink.net
More information about the kde-core-devel
mailing list