[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    =?utf-8?q?=5Bkdelibs=5D_kio/kio=3A_Allow_to_configure_thumbnail-?=
From:       Peter Penz <peter.penz19 () gmail ! com>
Date:       2011-02-27 19:12:12
Message-ID: 20110227191212.9FBF1A609B () git ! kde ! org
[Download RAW message or body]

Git commit 68570686e4cc5895a767cbfd732932f3536d894e by Peter Penz.
Committed on 26/02/2011 at 21:18.
Pushed by ppenz into branch 'master'.

Allow to configure thumbnail-plugins

Offer an interface that thumbnail-plugins can be configured by users. See https://git.reviewboard.kde.org/r/100717

M  +19   -0    kio/kio/thumbcreator.cpp     
M  +35   -2    kio/kio/thumbcreator.h     

http://commits.kde.org/kdelibs/68570686e4cc5895a767cbfd732932f3536d894e

diff --git a/kio/kio/thumbcreator.cpp b/kio/kio/thumbcreator.cpp
index 4384814..a1b2640 100644
--- a/kio/kio/thumbcreator.cpp
+++ b/kio/kio/thumbcreator.cpp
@@ -22,3 +22,22 @@
 ThumbCreator::~ThumbCreator()
 {
 }
+
+ThumbCreator::Flags ThumbCreator::flags() const
+{
+    return None;
+}
+
+ThumbCreatorV2::~ThumbCreatorV2()
+{
+}
+
+QWidget *ThumbCreatorV2::createConfigurationWidget()
+{
+    return 0;
+}
+
+void ThumbCreatorV2::writeConfiguration(const QWidget *configurationWidget)
+{
+    Q_UNUSED(configurationWidget);
+}
diff --git a/kio/kio/thumbcreator.h b/kio/kio/thumbcreator.h
index 51234e7..0076493 100644
--- a/kio/kio/thumbcreator.h
+++ b/kio/kio/thumbcreator.h
@@ -24,11 +24,14 @@
 
 class QString;
 class QImage;
+class QWidget;
+
 /**
  * This is the baseclass for "thumbnail-plugins" in KDE. Using the class
  * KIO::PreviewJob allows you to generate small images (thumbnails)
  * for any kind of file, where a "ThumbCreator" is available. Have a look
- * at kdebase/kioslave/thumbnail/ for existing ThumbCreators.
+ * at kdebase/kioslave/thumbnail/ for existing ThumbCreators. Use ThumbCreatorV2
+ * if the thumbnail-plugin should be configurable by the user.
  *
  * What you need to do to create and register a ThumbCreator:
  * @li Inherit from this class and reimplement the create() method to
@@ -138,7 +141,37 @@ public:
      *
      * @return flags for this plugin
      */
-    virtual Flags flags() const { return None; } //krazy:exclude=inline
+    virtual Flags flags() const;
+};
+
+/**
+ * @since 4.7
+ */
+class KIO_EXPORT ThumbCreatorV2 : public ThumbCreator
+{
+public:
+    virtual ~ThumbCreatorV2();
+
+    /**
+     * Creates a widget that allows to configure the
+     * thumbcreator by the user. The caller of this method is defined
+     * as owner of the returned instance and must take care to delete it.
+     * The default implementation returns 0.
+     *
+     * The following key in the thumbcreator .desktop file must be set to
+     * mark the plugin as configurable:
+     * \code
+     * Configurable=true
+     * \endcode
+     */
+    virtual QWidget *createConfigurationWidget();
+
+    /**
+     * Writes the configuration that is specified by \p configurationWidget.
+     * The passed configuration widget is the instance created by
+     * ThumbCreatorV2::createConfigurationWidget().
+     */
+    virtual void writeConfiguration(const QWidget* configurationWidget);
 };
 
 typedef ThumbCreator *(*newCreator)();

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic