Help regarding the code

sujith h sujith.h at gmail.com
Tue Sep 14 20:59:47 CEST 2010


Hi,

I were trying to modify the frame applet in kdeplasma-addons.
I am having a small issue with the diff attached with the mail(frame.diff).
The backtrace is also attached with
the mail(backtrace.txt). My intention is to pass emit the a function in
slideshow.cppwhen the directory is empty
to load images and then use the connect in the picture.cpp to write some
message to the a QString variable.
In the mean while I am initializing an object of SlideShow class using:

m_slideshow = new SlideShow(this);

Should this cause a problem? Pardon me if am wrong.


Sujith H
-- 
സുജിത് ഹരിദാസന്
Bangalore
http://fci.wikia.com/wiki/Anti-DRM-Campaign
<Blog> http://sujithh.info
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/plasma-devel/attachments/20100915/db271e14/attachment.htm 
-------------- next part --------------
Index: slideshow.cpp
===================================================================
--- slideshow.cpp	(revision 1174498)
+++ slideshow.cpp	(working copy)
@@ -74,6 +74,10 @@
 
     // TODO do something meaningful if m_picturePaths.empty()
     kDebug() << "Loaded " << m_picturePaths.size() << " pictures in " << setDirStart.secsTo(QDateTime::currentDateTime()) << " seconds";
+    if( m_picturePaths.size() == 0) {
+        kDebug() << "Nothing to display, empty set";
+        emit emptyDirMessage();
+    }
 }
 
 void SlideShow::setImage(const QString &imagePath)
@@ -109,6 +113,7 @@
 {
     if (m_image.isNull() || m_currentUrl != m_picture->url()) {
         kDebug() << "reloading from Picture" << m_currentUrl;
+        kDebug() << "No Picture to show";
         //m_currentUrl = m_picture->url();
         m_picture->setPicture(m_currentUrl);
     }
Index: slideshow.h
===================================================================
--- slideshow.h	(revision 1174498)
+++ slideshow.h	(working copy)
@@ -57,6 +57,7 @@
 
 Q_SIGNALS:
     void pictureUpdated();
+    QString emptyDirMessage();
 
 private Q_SLOTS:
     void clearPicture();
Index: picture.cpp
===================================================================
--- picture.cpp	(revision 1174498)
+++ picture.cpp	(working copy)
@@ -34,6 +34,7 @@
 #include <Plasma/Svg>
 
 #include "imageloader.h"
+#include "slideshow.h"
 
 Picture::Picture(QObject *parent)
         : QObject(parent)
@@ -42,6 +43,8 @@
 
     // listen for changes to the file we're displaying
     m_fileWatch = new KDirWatch(this);
+    m_slideshow = new SlideShow(this);
+    connect(m_slideshow, SIGNAL(emptyDirMessage()), this, SLOT(customizeEmptyMessage()));
     connect(m_fileWatch,SIGNAL(dirty(QString)),this,SLOT(reload()));
     connect(m_fileWatch,SIGNAL(created(QString)),this,SLOT(reload()));
     connect(m_fileWatch,SIGNAL(deleted(QString)),this,SLOT(reload()));
@@ -121,6 +124,13 @@
     QThreadPool::globalInstance()->start(loader);
 }
 
+QString Picture::customizeEmptyMessage() 
+{
+   kDebug() << "The call to empty directory";
+   m_message = i18nc("Info", "Directory that is dropped is empty. Please update the directory or drop a new directory");
+   return m_message;
+}
+
 void Picture::slotFinished( KJob *job )
 {
     QString filename = m_currentUrl.fileName();
Index: picture.h
===================================================================
--- picture.h	(revision 1174498)
+++ picture.h	(working copy)
@@ -34,6 +34,7 @@
  * makes it ready for the Frame class to paint this picture.
  */
 
+class SlideShow;
 class Picture : public QObject
 {
     Q_OBJECT
@@ -62,6 +63,7 @@
     void slotFinished(KJob *job);
     void reload();
     void checkImageLoaded(QImage newImage);
+    QString customizeEmptyMessage(); 
 
 private:
     void setPath(const QString &path);
@@ -70,6 +72,7 @@
     KDirWatch *m_fileWatch;
     QString m_message;
     QString m_defaultImage;
+    SlideShow *m_slideshow;
 };
 
 
-------------- next part --------------
[sujith at myhost ~]$ gdb plasmoidviewer
GNU gdb (GDB) 7.1
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/sujith/kde/bin/plasmoidviewer...done.
(gdb) r frame
Starting program: /home/sujith/kde/bin/plasmoidviewer frame
[Thread debugging using libthread_db enabled]
Qt: gdb: -nograb added to command-line options.
         Use the -dograb option to enforce grabbing.
plasmoidviewer(2803)/plasma main: setting FormFactor to "planar"
plasmoidviewer(2803)/plasma main: setting Location to "floating"
plasmoidviewer(2803)/plasma main: setting containment to "null"
plasmoidviewer(2803)/plasma main: setting auth policy
plasmoidviewer(2803)/libplasma Plasma::Corona::Corona: !!{} STARTUP TIME 1558736 Corona ctor start
plasmoidviewer(2803)/plasma main: just load applet
plasmoidviewer(2803)/plasma FullView::addApplet: adding applet "frame" in "null"
plasmoidviewer(2803)/kdecore (KSycoca) KSycocaPrivate::openDatabase: Trying to open ksycoca from "/var/tmp/kdecache-sujith/ksycoca4"
plasmoidviewer(2803)/libplasma Plasma::FrameSvg::resizeFrame: Invalid size QSizeF(0, 0) 
plasmoidviewer(2803)/libplasma Plasma::AppletPrivate::init: Check your constructor!  You probably want to be passing in a Service::Ptr  or a QVariantList with a valid storageid as arg[0].
plasmoidviewer(2803)/libplasma Plasma::Containment::restore: ()
plasmoidviewer(2803)/libplasma Plasma::FrameSvg::resizeFrame: Invalid size QSizeF(0, 0) 

Program received signal SIGSEGV, Segmentation fault.
0xb7d02d43 in QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::operator-> (this=0xbf3bbbc)
    at /home/sujith/kde-qt/include/QtCore/qscopedpointer.h:110
110         inline T *operator->() const
(gdb) bt
#0  0xb7d02d43 in QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::operator-> (this=0xbf3bbbc)
    at /home/sujith/kde-qt/include/QtCore/qscopedpointer.h:110
#1  0xb7d414a8 in QObject::isWidgetType (this=0xbf3bbb8) at /home/sujith/kde-qt/include/QtCore/qobject.h:156
#2  0xb7e4ee60 in KCheckAccelerators::eventFilter (this=0x8157400, obj=0xbf3b858, e=0xbf8005b4)
    at /media/disk/kde-dev/kde/src/KDE/kdelibs/kdeui/shortcuts/kcheckaccelerators.cpp:111
#3  0xb68332be in QCoreApplicationPrivate::sendThroughApplicationEventFilters (this=0x808da18, receiver=0xbf3b858, event=0xbf8005b4)
    at kernel/qcoreapplication.cpp:800
#4  0xb6e731f4 in QApplicationPrivate::notify_helper (this=0x808da18, receiver=0xbf3b858, e=0xbf8005b4) at kernel/qapplication.cpp:4279
#5  0xb6e70be4 in QApplication::notify (this=0xbffff078, receiver=0xbf3b858, e=0xbf8005b4) at kernel/qapplication.cpp:3708
#6  0xb7defcee in KApplication::notify (this=0xbffff078, receiver=0xbf3b858, event=0xbf8005b4)
    at /media/disk/kde-dev/kde/src/KDE/kdelibs/kdeui/kernel/kapplication.cpp:310
#7  0xb68330cf in QCoreApplication::notifyInternal (this=0xbffff078, receiver=0xbf3b858, event=0xbf8005b4) at kernel/qcoreapplication.cpp:704
#8  0xb6e65971 in QCoreApplication::sendEvent (receiver=0xbf3b858, event=0xbf8005b4)
    at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215
#9  0xb6849714 in QObjectPrivate::setParent_helper (this=0xbf3bbf8, o=0xbf3b858) at kernel/qobject.cpp:2029
#10 0xb6849409 in QObject::setParent (this=0xbf3bbb8, parent=0xbf3b858) at kernel/qobject.cpp:1973
#11 0xb6847472 in QObject (this=0xbf3bbb8, parent=0xbf3b858) at kernel/qobject.cpp:763
#12 0xac20555e in SlideShow (this=0xbf3bbb8, parent=0xbf3b858)
    at /media/disk/kde-dev/kde/src/KDE/kdeplasma-addons/applets/frame/slideshow.cpp:32
#13 0xac207a13 in Picture (this=0xbf3b858, parent=0xbf3b698) at /media/disk/kde-dev/kde/src/KDE/kdeplasma-addons/applets/frame/picture.cpp:46
#14 0xac20572e in SlideShow (this=0xbf3b698, parent=0xbf3b338)
    at /media/disk/kde-dev/kde/src/KDE/kdeplasma-addons/applets/frame/slideshow.cpp:38
#15 0xac207a13 in Picture (this=0xbf3b338, parent=0xbf3b178) at /media/disk/kde-dev/kde/src/KDE/kdeplasma-addons/applets/frame/picture.cpp:46
#16 0xac20572e in SlideShow (this=0xbf3b178, parent=0xbf3add8)
    at /media/disk/kde-dev/kde/src/KDE/kdeplasma-addons/applets/frame/slideshow.cpp:38
#17 0xac207a13 in Picture (this=0xbf3add8, parent=0xbf3ac18) at /media/disk/kde-dev/kde/src/KDE/kdeplasma-addons/applets/frame/picture.cpp:46
#18 0xac20572e in SlideShow (this=0xbf3ac18, parent=0xbf3a8a0)
    at /media/disk/kde-dev/kde/src/KDE/kdeplasma-addons/applets/frame/slideshow.cpp:38
#19 0xac207a13 in Picture (this=0xbf3a8a0, parent=0xbf3a6e0) at /media/disk/kde-dev/kde/src/KDE/kdeplasma-addons/applets/frame/picture.cpp:46
#20 0xac20572e in SlideShow (this=0xbf3a6e0, parent=0xbf3a368)
    at /media/disk/kde-dev/kde/src/KDE/kdeplasma-addons/applets/frame/slideshow.cpp:38
#21 0xac207a13 in Picture (this=0xbf3a368, parent=0xbf3a1a8) at /media/disk/kde-dev/kde/src/KDE/kdeplasma-addons/applets/frame/picture.cpp:46
#22 0xac20572e in SlideShow (this=0xbf3a1a8, parent=0xbf39e30)
    at /media/disk/kde-dev/kde/src/KDE/kdeplasma-addons/applets/frame/slideshow.cpp:38
#23 0xac207a13 in Picture (this=0xbf39e30, parent=0xbf39c70) at /media/disk/kde-dev/kde/src/KDE/kdeplasma-addons/applets/frame/picture.cpp:46
#24 0xac20572e in SlideShow (this=0xbf39c70, parent=0xbf398f8)
    at /media/disk/kde-dev/kde/src/KDE/kdeplasma-addons/applets/frame/slideshow.cpp:38
#25 0xac207a13 in Picture (this=0xbf398f8, parent=0xbf39738) at /media/disk/kde-dev/kde/src/KDE/kdeplasma-addons/applets/frame/picture.cpp:46
#26 0xac20572e in SlideShow (this=0xbf39738, parent=0xbf393c0)
    at /media/disk/kde-dev/kde/src/KDE/kdeplasma-addons/applets/frame/slideshow.cpp:38
#27 0xac207a13 in Picture (this=0xbf393c0, parent=0xbf39200) at /media/disk/kde-dev/kde/src/KDE/kdeplasma-addons/applets/frame/picture.cpp:46
#28 0xac20572e in SlideShow (this=0xbf39200, parent=0xbf38e88)
    at /media/disk/kde-dev/kde/src/KDE/kdeplasma-addons/applets/frame/slideshow.cpp:38


More information about the Plasma-devel mailing list