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

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma
From:       Alexander Wiedenbruch <wirr01 () gmail ! com>
Date:       2007-06-01 21:32:04
Message-ID: 1180733524.164205.32084.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 670527 by wirr:

Add KarambaManager for easier loading of SuperKaramba themes


 M  +1 -0      lib/CMakeLists.txt  
 M  +11 -20    lib/corona.cpp  
 M  +7 -0      lib/corona.h  
 A             lib/karambamanager.cpp   [License: LGPL (v2)]
 A             lib/karambamanager.h   [License: LGPL (v2)]
 M  +4 -0      plasma/rootwidget.cpp  


--- trunk/KDE/kdebase/workspace/plasma/lib/CMakeLists.txt #670526:670527
@@ -13,6 +13,7 @@
    plasma_export.h
    svg.cpp
    theme.cpp
+   karambamanager.cpp
    widgets/checkbox.cpp
    widgets/icon.cpp
    widgets/lineedit.cpp
--- trunk/KDE/kdebase/workspace/plasma/lib/corona.cpp #670526:670527
@@ -32,6 +32,7 @@
 #include "applet.h"
 #include "dataengine.h"
 #include "widgets/vboxlayout.h"
+#include "karambamanager.h"
 
 #ifdef ICON_DEMO
 #include "widgets/icon.h"
@@ -40,9 +41,6 @@
 #include "corona.h"
 
 using namespace Plasma;
-extern "C" {
-    typedef QGraphicsItem* (*loadKaramba)(const KUrl &theme, QGraphicsView *view);
-}
 
 namespace Plasma
 {
@@ -116,23 +114,6 @@
     kDebug() << "=========================" << endl;
     */
 
-    // Loading SuperKaramba themes example
-    /*
-    QString karambaLib = \
                QFile::encodeName(KLibLoader::self()->findLibrary(QLatin1String("libsuperkaramba")));
                
-    KLibLoader* loader = KLibLoader::self();
-    KLibrary* lib = loader->library(karambaLib);
-
-    if (lib) {
-        loadKaramba startKaramba = 0;
-        startKaramba = (loadKaramba)lib->resolveFunction("startKaramba");
-        if (startKaramba) {
-            startKaramba(KUrl("~/themes/aero_aio.skz"), this);
-        }
-
-        lib->unload();
-    }
-    */
-
 //    connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, \
SLOT(displayContextMenu(QPoint)));  d->engineExplorerAction = new \
                QAction(i18n("Engine Explorer"), this);
     connect(d->engineExplorerAction, SIGNAL(triggered(bool)), this, \
SLOT(launchExplorer(bool))); @@ -205,6 +186,16 @@
     }
 }
 
+void Corona::addKaramba(const KUrl& path)
+{
+    QGraphicsItemGroup* karamba = KarambaManager::loadKaramba(path, this);
+    if (karamba) {
+        addItem(karamba);
+    } else {
+        kDebug() << "Karamba " << path << " could not be loaded." << endl;
+    }
+}
+
 void Corona::dragEnterEvent( QGraphicsSceneDragDropEvent *event)
 {
     kDebug() << "Corona::dragEnterEvent(QGraphicsSceneDragDropEvent* event)" << \
                endl;
--- trunk/KDE/kdebase/workspace/plasma/lib/corona.h #670526:670527
@@ -81,6 +81,13 @@
      */
     void addPlasmoid(const QString& name);
 
+    /**
+     * Adds a SuperKaramba theme to the scene
+     *
+     * @param path the path to the theme file
+     */
+    void addKaramba(const KUrl& path);
+
 protected:
     void dragEnterEvent(QGraphicsSceneDragDropEvent* event);
     void dragLeaveEvent(QGraphicsSceneDragDropEvent* event);
--- trunk/KDE/kdebase/workspace/plasma/plasma/rootwidget.cpp #670526:670527
@@ -56,6 +56,10 @@
     m_controlBox->show();
 
     connect(m_controlBox, SIGNAL(addPlasmoid(const QString&)), m_view->corona(), \
SLOT(addPlasmoid(const QString&))); +
+    #ifdef SUPERKARAMBA_DEMO
+        m_view->corona()->addKaramba(KUrl("~/themes/aero_aio.skz"));
+    #endif
 }
 
 RootWidget::~RootWidget()


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

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