[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdegraphics/kuickshow/src
From: Carsten Pfeiffer <carpdjih () mailbox ! tu-berlin ! de>
Date: 2004-12-29 2:58:10
Message-ID: 20041229025810.124341BBBB () office ! kde ! org
[Download RAW message or body]
CVS commit by pfeiffer:
wince of a dead...
two bugfixes:
- make Key_Return toggle fullscreen mode again
- fall back to KImageIO when imlib is unable to read an image)
M +9 -5 imagewindow.cpp 1.63
M +47 -2 imlibwidget.cpp 1.16
M +3 -1 imlibwidget.h 1.13
M +1 -1 version.h 1.6
--- kdegraphics/kuickshow/src/imagewindow.cpp #1.62:1.63
@@ -221,9 +221,5 @@ void ImageWindow::setupActions()
m_actions, "kuick_slideshow_pause" );
- KShortcut cut(Key_Return);
- cut.append(KStdAccel::shortcut(KStdAccel::FullScreen));
-
- KAction *action = KStdAction::fullScreen(this, SLOT( toggleFullscreen() ), m_actions, 0 );
- action->setShortcut(cut);
+ KAction *fullscreenAction = KStdAction::fullScreen(this, SLOT( toggleFullscreen() ), m_actions, 0 );
new KAction( i18n("Reload Image"), Key_Enter,
@@ -236,4 +232,12 @@ void ImageWindow::setupActions()
m_actions->readShortcutSettings();
+
+ // Unfortunately there is no KAction::setShortcutDefault() :-/
+ // so add Key_Return as fullscreen shortcut _after_ readShortcutSettings()
+ KShortcut cut( fullscreenAction->shortcut() );
+ if ( cut == fullscreenAction->shortcutDefault() ) {
+ cut.append(KKey(Key_Return));
+ fullscreenAction->setShortcut(cut);
+ }
}
--- kdegraphics/kuickshow/src/imlibwidget.cpp #1.15:1.16
@@ -27,4 +27,5 @@
#include <qfile.h>
#include <qglobal.h>
+#include <qimage.h>
#include <qobject.h>
#include <qpalette.h>
@@ -33,4 +34,5 @@
#include <kdebug.h>
#include <kfilemetainfo.h>
+#include <kimageio.h>
#include "imlibwidget.h"
@@ -755,6 +757,9 @@ KuickImage * ImageCache::getKuimage( con
slotIdle();
+ if ( !im ) {
+ im = loadImageWithQt( file );
if ( !im )
return 0L;
+ }
Imlib_set_image_modifier( myId, im, &mod );
@@ -777,4 +782,44 @@ KuickImage * ImageCache::getKuimage( con
+// Note: the returned image's filename will not be the real filename (which it usually
+// isn't anyway, according to Imlib's sources).
+ImlibImage * ImageCache::loadImageWithQt( const QString& fileName ) const
+{
+ kdDebug() << "Trying to load " << fileName << " with KImageIO..." << endl;
+
+ KImageIO::registerFormats();
+
+ QImage image( fileName );
+ if ( image.isNull() )
+ return 0L;
+ if ( image.depth() != 32 ) {
+ image.setAlphaBuffer(false);
+ image = image.convertDepth(32);
+ }
+ if ( image.isNull() )
+ return 0L;
+
+ // convert to 24 bpp (discard alpha)
+ int numPixels = image.width() * image.height();
+ const int NUM_BYTES_ORIG = 4; // 32 bpp
+ const int NUM_BYTES_NEW = 3; // 24 bpp
+ uchar *newImageData = new uchar[numPixels * NUM_BYTES_NEW];
+ uchar *newData = newImageData;
+ uchar *origData = image.bits();
+
+ for (int i = 0; i < numPixels; i++) {
+ memcpy( newData, origData , NUM_BYTES_NEW);
+ newData += NUM_BYTES_NEW;
+ origData += NUM_BYTES_ORIG;
+ }
+
+ ImlibImage *im = Imlib_create_image_from_data( myId, newImageData, NULL,
+ image.width(), image.height() );
+
+ delete[] newImageData;
+
+ return im;
+}
+
/*
KuickImage * ImageCache::find( const QString& file )
--- kdegraphics/kuickshow/src/imlibwidget.h #1.12:1.13
@@ -103,4 +103,6 @@ public:
private:
+ ImlibImage * loadImageWithQt( const QString& filename ) const;
+
int myMaxImages;
QStringList fileList;
--- kdegraphics/kuickshow/src/version.h #1.5:1.6
@@ -1,3 +1,3 @@
#ifndef KUICKSHOWVERSION
-#define KUICKSHOWVERSION "0.8.6"
+#define KUICKSHOWVERSION "0.8.7"
#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic