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

List:       kde-commits
Subject:    [kipi-plugins] tests/helloworld: polish
From:       Gilles Caulier <caulier.gilles () gmail ! com>
Date:       2012-03-31 17:11:48
Message-ID: 20120331171148.1BDAEA60A9 () git ! kde ! org
[Download RAW message or body]

Git commit f75769be5d8dd0c518215c11ee8e93a552fb420d by Gilles Caulier.
Committed on 31/03/2012 at 19:11.
Pushed by cgilles into branch 'master'.

polish

M  +25   -8    tests/helloworld/plugin_helloworld.cpp

http://commits.kde.org/kipi-plugins/f75769be5d8dd0c518215c11ee8e93a552fb420d

diff --git a/tests/helloworld/plugin_helloworld.cpp \
b/tests/helloworld/plugin_helloworld.cpp index 4fc260e..240a273 100644
--- a/tests/helloworld/plugin_helloworld.cpp
+++ b/tests/helloworld/plugin_helloworld.cpp
@@ -37,23 +37,24 @@
 #include <libkipi/imagecollection.h>
 #include <libkipi/interface.h>
 
-// You must wrap all your plugin code to a dedicated namespace
+/// You must wrap all your plugin code to a dedicated namespace
 namespace KIPIHelloWorldPlugin
 {
 
-// Macros from KDE KParts to export the symbols for this plugin and
-// create the factory for it. The first argument is the name of the
-// plugin library and the second is the genericfactory templated from
-// the class for your plugin
-
+/**
+ * Macros from KDE KParts to export the symbols for this plugin and
+ * create the factory for it. The first argument is the name of the
+ * plugin library and the second is the genericfactory templated from
+ * the class for your plugin
+ */
 K_PLUGIN_FACTORY(HelloWorldFactory, registerPlugin<Plugin_HelloWorld>();)
-
 K_EXPORT_PLUGIN(HelloWorldFactory("kipiplugin_helloworld") )
 
 Plugin_HelloWorld::Plugin_HelloWorld(QObject* const parent, const QVariantList&)
     : KIPI::Plugin(HelloWorldFactory::componentData(), parent, "HelloWorld")
 {
-    kDebug() << "Plugin_HelloWorld plugin loaded";
+    /// There is a debug space for plugin loading area.
+    kDebug(AREA_CODE_LOADING) << "Plugin_HelloWorld plugin loaded";
 }
 
 Plugin_HelloWorld::~Plugin_HelloWorld()
@@ -62,33 +63,48 @@ Plugin_HelloWorld::~Plugin_HelloWorld()
 
 void Plugin_HelloWorld::setup(QWidget* widget)
 {
+    /** We pass the widget which host plugin in KIPI host application
+     */
     KIPI::Plugin::setup(widget);
 
+    /** We define plugin action which will be plug in KIPI host application.
+     */
     m_action = actionCollection()->addAction("helloworld");
     m_action->setText(i18n("Hello World..."));
     m_action->setIcon(KIcon("misc"));
 
+    /** Connect action signal to dedicated slot.
+     */
     connect(m_action, SIGNAL(triggered(bool)),
             this, SLOT(slotActivate()));
 
+    /** Action is registered in plugin instance.
+     */
     addAction(m_action);
 
     m_iface = dynamic_cast<KIPI::Interface*>(parent());
     if (!m_iface)
     {
+       /// No need special debug space outside load plugin area, it will be selected \
automatically.  kError() << "Kipi interface is null!";
        return;
     }
 
+    /** This will get items selection from KIPI host application
+     */
     KIPI::ImageCollection selection = m_iface->currentSelection();
     m_action->setEnabled(selection.isValid() && !selection.images().isEmpty());
 
+    /** If selection change in KIPI host application, this signal will be fired, and \
plugin action enabled accordingly. +     */
     connect(m_iface, SIGNAL(selectionChanged(bool)),
             m_action, SLOT(setEnabled(bool)));
 }
 
 void Plugin_HelloWorld::slotActivate()
 {
+    /** When plugin action is actived, we display list of item selected in a message \
box +     */
     KIPI::ImageCollection images = m_iface->currentSelection();
 
     if (!images.isValid() || images.images().isEmpty())
@@ -105,6 +121,7 @@ KIPI::Category Plugin_HelloWorld::category(KAction* action) const
     if (action == m_action)
        return KIPI::ImagesPlugin;
 
+    /// No need special debug space outside load plugin area, it will be selected \
                automatically.
     kWarning() << "Unrecognized action for plugin category identification";
     return KIPI::ImagesPlugin; // no warning from compiler, please
 }


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

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