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

List:       kde-commits
Subject:    playground/sysadmin/shaman
From:       Dario Freddi <drf () kde ! org>
Date:       2010-02-16 18:55:56
Message-ID: 1266346556.211620.12235.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1091131 by dafre:

And this makes the new shamangui library work

Signed-off-by: Dario Freddi <drf@kde.org>

 M  +4 -0      CMakeLists.txt  
 M  +2 -0      libshaman/CMakeLists.txt  
 M  +0 -3      libshaman/pluginsystem/CorePluginLoader.cpp  
 M  +3 -0      libshaman/pluginsystem/ProviderPluginLoader.cpp  
 M  +1 -0      libshaman/shamanmacros.h.cmake  
 M  +1 -0      libshaman/shamanprovider.h  
 M  +1 -1      plugins/CMakeLists.txt  
 M  +1 -1      plugins/packagedetail/CMakeLists.txt  
 M  +1 -1      plugins/packagesview/CMakeLists.txt  
 M  +2 -0      shaman/CMakeLists.txt  
 M  +3 -1      shaman/libshamangui/CMakeLists.txt  
 A             shaman/libshamangui/GuiPluginLoader.cpp   [License: GPL (v2+)]
 A             shaman/libshamangui/GuiPluginLoader.h   [License: GPL (v2+)]
 D             shaman/libshamangui/PluginLoader.cpp  
 D             shaman/libshamangui/PluginLoader_p.h  
 M  +1 -0      shaman/libshamangui/scripting/CMakeLists.txt  
 M  +42 -2     shaman/libshamangui/shamanguiinterface.cpp  
 M  +15 -1     shaman/libshamangui/shamanguiinterface.h  
 A             shaman/libshamangui/shamanguiinterface_p.h   [License: GPL (v2+)]
 M  +3 -2      shaman/libshamangui/shamanguiplugin.cpp  
 M  +8 -5      shaman/src/MainWindow.cpp  
 M  +1 -0      shaman/src/MainWindow.h  
 M  +3 -1      shaman/src/updatedatabase/UpdateDatabaseHandler.cpp  


--- trunk/playground/sysadmin/shaman/CMakeLists.txt #1091130:1091131
@@ -16,6 +16,10 @@
    # To be removed when libshaman will be moved to its own tree
    libshaman/
    ${CMAKE_CURRENT_BINARY_DIR}/libshaman
+
+   # As above
+   shaman/libshamangui
+   ${CMAKE_CURRENT_BINARY_DIR}/shaman/libshamangui
 )
 
 add_subdirectory(libshaman)
--- trunk/playground/sysadmin/shaman/libshaman/CMakeLists.txt #1091130:1091131
@@ -11,6 +11,8 @@
 # Include the backend
 include(BackendSelector.cmake)
 
+set(SCRIPTED_PLUGINS_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/shaman/scriptplugins)
+
 # Configure files
 configure_file(backend-config_p.h.cmake \
${CMAKE_CURRENT_BINARY_DIR}/backend-config_p.h)  configure_file(shamanmacros.h.cmake \
                ${CMAKE_CURRENT_BINARY_DIR}/shamanmacros.h)
--- trunk/playground/sysadmin/shaman/libshaman/pluginsystem/CorePluginLoader.cpp \
#1091130:1091131 @@ -40,9 +40,6 @@
         return 0;
     }
 
-    // Switch here: we need to know what to do with each plugin.
-    QString ptype = offer->property("X-KDE-Shaman-plugin-type").toString();
-
     CorePlugin * plugin = factory->create< CorePlugin >(parent);
 
     if ( !plugin ) {
--- trunk/playground/sysadmin/shaman/libshaman/pluginsystem/ProviderPluginLoader.cpp \
#1091130:1091131 @@ -53,6 +53,9 @@
         return 0;
     }
 
+    // Create a provider out of it BEFORE initializing it
+    Provider *provider = new Provider(plugin, parent);
+
     return plugin;
 }
 
--- trunk/playground/sysadmin/shaman/libshaman/shamanmacros.h.cmake #1091130:1091131
@@ -33,6 +33,7 @@
 
 #define SHAMAN_PLUGIN_IMPORT( C ) qobject_cast<AbstractPlugin *>(C)
 #define SHAMAN_GUI_PLUGIN_IMPORT( C ) qobject_cast<GuiPlugin *>(C)
+#define SHAMAN_SCRIPTED_PLUGINS_INSTALL_DIR "${SCRIPTED_PLUGINS_INSTALL_DIR}"
 
 // Versioning stuff
 /// @brief LibShaman version as string at compile time.
--- trunk/playground/sysadmin/shaman/libshaman/shamanprovider.h #1091130:1091131
@@ -68,6 +68,7 @@
         friend class PluginLoader;
         friend class ProviderPlugin;
         friend class CoreInterface;
+        friend class ProviderPluginLoader;
 };
 
 }
--- trunk/playground/sysadmin/shaman/plugins/CMakeLists.txt #1091130:1091131
@@ -12,4 +12,4 @@
 endif(AQPMAUR_FOUND)
 add_subdirectory(testhooksplugin)
 #add_subdirectory(providerui)
-add_subdirectory(logger)
\ No newline at end of file
+add_subdirectory(logger)
--- trunk/playground/sysadmin/shaman/plugins/packagedetail/CMakeLists.txt \
#1091130:1091131 @@ -10,6 +10,6 @@
 )
 
 kde4_add_plugin(shaman_packagedetailplugin ${packagedetailplugin_SRCS})
-target_link_libraries(shaman_packagedetailplugin ${KDE4_KDEUI_LIBS} shamancore)
+target_link_libraries(shaman_packagedetailplugin ${KDE4_KDEUI_LIBS} shamancore \
shamangui)  install(TARGETS shaman_packagedetailplugin DESTINATION  \
${PLUGIN_INSTALL_DIR})  install(FILES shaman_packagedetail.desktop DESTINATION \
                ${SERVICES_INSTALL_DIR})
--- trunk/playground/sysadmin/shaman/plugins/packagesview/CMakeLists.txt \
#1091130:1091131 @@ -21,7 +21,7 @@
 )
 
 kde4_add_plugin(shaman_packagesviewplugin ${packagesviewplugin_SRCS})
-target_link_libraries(shaman_packagesviewplugin ${KDE4_KDEUI_LIBS} shamancore)
+target_link_libraries(shaman_packagesviewplugin ${KDE4_KDEUI_LIBS} shamancore \
shamangui)  install(TARGETS shaman_packagesviewplugin DESTINATION  \
${PLUGIN_INSTALL_DIR})  install(FILES shaman_packagesview.desktop DESTINATION \
${SERVICES_INSTALL_DIR})  
--- trunk/playground/sysadmin/shaman/shaman/CMakeLists.txt #1091130:1091131
@@ -1,5 +1,7 @@
 project(shaman)
 
+include_directories(libshamangui)
+
 # Compile libshamangui
 add_subdirectory(libshamangui)
 
--- trunk/playground/sysadmin/shaman/shaman/libshamangui/CMakeLists.txt \
#1091130:1091131 @@ -14,6 +14,8 @@
     shamanstatusbarinterface.cpp
     shamanguimacros.cpp
 
+    GuiPluginLoader.cpp
+
     scripting/ScriptGuiPlugin.cpp
     scripting/wrapper/PackageGroupWrapper.cpp
     scripting/wrapper/RepositoryWrapper.cpp
@@ -21,7 +23,7 @@
 
 kde4_add_library(shamangui SHARED ${shamangui_SRCS} ${BACKEND_SRCS})
 
-target_link_libraries(shamangui ${KDE4_KDEUI_LIBS} ${KDE4_KROSSCORE_LIBS})
+target_link_libraries(shamangui shamancore ${KDE4_KDEUI_LIBS} \
${KDE4_KROSSCORE_LIBS})  
 set_target_properties(shamangui PROPERTIES VERSION \
                ${CMAKE_LIBSHAMANGUI_VERSION_STRING}
                                             SOVERSION \
                ${CMAKE_LIBSHAMANGUI_VERSION_MAJOR})
--- trunk/playground/sysadmin/shaman/shaman/libshamangui/scripting/CMakeLists.txt \
#1091130:1091131 @@ -12,6 +12,7 @@
 )
 
 target_link_libraries(shaman_scriptguiplugin
+    shamangui
     shamancore
     ${QT_QTGUI_LIBRARY}
     ${KDE4_KROSSCORE_LIBS}
--- trunk/playground/sysadmin/shaman/shaman/libshamangui/shamanguiinterface.cpp \
#1091130:1091131 @@ -1,6 +1,6 @@
 /* This file is part of the KDE project
 
-   Copyright (C) 2008 Dario Freddi <drf@kde.org>
+   Copyright (C) 2008-2010 Dario Freddi <drf@kde.org>
                  2008 Lukas Appelhans <l.appelhans@gmx.de>
 
    This program is free software; you can redistribute it and/or
@@ -8,14 +8,41 @@
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.
 */
-#include "shamanguiinterface.h"
+#include "shamanguiinterface_p.h"
 
 #include <QDockWidget>
+#include <shamanbase.h>
+#include "GuiPluginLoader.h"
+#include "shamanstatusbarinterface.h"
 
 namespace Shaman {
+
+class GuiInterfaceHelper
+{
+  public:
+    GuiInterfaceHelper() : q(0) {}
+    ~GuiInterfaceHelper() { delete q; }
+    GuiInterface *q;
+};
+
+K_GLOBAL_STATIC(GuiInterfaceHelper, s_globalGuiInterface)
+
+GuiInterface *GuiInterface::instance()
+{
+    if (!s_globalGuiInterface->q) {
+        new GuiInterface(Shaman::Base::instance());
+    }
+
+    return s_globalGuiInterface->q;
+}
+
 GuiInterface::GuiInterface(QObject * parent)
   : QObject(parent)
+  , d_ptr(new GuiInterfacePrivate)
 {
+    Q_ASSERT(!s_globalGuiInterface->q);
+    s_globalGuiInterface->q = this;
+    Shaman::Base::instance()->registerPluginLoader(new GuiPluginLoader);
 }
 
 GuiInterface::~GuiInterface()
@@ -36,6 +63,19 @@
 {
     emit createAction(action);
 }
+
+void GuiInterface::setStatusBar(QStatusBar* bar)
+{
+    Q_D(GuiInterface);
+    d->statusBar = new StatusBarInterface(bar, this);
 }
 
+StatusBarInterface* GuiInterface::statusBar()
+{
+    Q_D(GuiInterface);
+    return d->statusBar;
+}
+
+}
+
 #include "shamanguiinterface.moc"
--- trunk/playground/sysadmin/shaman/shaman/libshamangui/shamanguiinterface.h \
#1091130:1091131 @@ -16,8 +16,12 @@
 class QWidget;
 class QDockWidget;
 class QAction;
+class QStatusBar;
 
 namespace Shaman {
+
+class StatusBarInterface;
+class GuiInterfacePrivate;
 /** \class GuiInterface shamanguiinterface.h
  * \brief Shaman's GuiInterface-class
  *
@@ -35,8 +39,9 @@
 {
     Q_OBJECT
     Q_DISABLE_COPY(GuiInterface)
+    Q_DECLARE_PRIVATE(GuiInterface)
     public:
-        GuiInterface(QObject * parent);
+        static GuiInterface *instance();
         virtual ~GuiInterface();
 
     public Q_SLOTS:
@@ -60,10 +65,19 @@
          */
         void addAction(QAction * action);
 
+        StatusBarInterface *statusBar();
+
+        void setStatusBar(QStatusBar *bar);
+
     Q_SIGNALS:
         void createMainWidget(QWidget * widget);
         void createDockWidget(Qt::DockWidgetArea area, QDockWidget * widget);
         void createAction(QAction * action);
+
+    private:
+        GuiInterface(QObject * parent);
+
+        GuiInterfacePrivate * const d_ptr;
 };
 }
 #endif
--- trunk/playground/sysadmin/shaman/shaman/libshamangui/shamanguiplugin.cpp \
#1091130:1091131 @@ -13,6 +13,7 @@
 #include "shamanbase.h"
 
 #include <KDebug>
+#include "shamanguiinterface.h"
 
 namespace Shaman {
 GuiPlugin::GuiPlugin(QObject *parent)
@@ -29,12 +30,12 @@
 
 GuiInterface * GuiPlugin::gui()
 {
-    return Base::instance()->gui();
+    return GuiInterface::instance();
 }
 
 StatusBarInterface * GuiPlugin::statusBar()
 {
-    return Base::instance()->statusBar();
+    return GuiInterface::instance()->statusBar();
 }
 }
 
--- trunk/playground/sysadmin/shaman/shaman/src/MainWindow.cpp #1091130:1091131
@@ -36,6 +36,7 @@
 #include <KApplication>
 #include <KNotification>
 #include <KCMultiDialog>
+#include "shamanguiinterface.h"
 
 MainWindow::MainWindow(KAboutData *data)
   : KXmlGuiWindow(),
@@ -69,16 +70,18 @@
 
     m_shaman = Shaman::Base::instance();
     m_shaman->setConfigurationFile(KGlobal::config());
-    m_shaman->setStatusBar(statusBar());
+    m_shamanGui = GuiInterface::instance();
+    m_shamanGui->setStatusBar(statusBar());
 
-    connect(m_shaman, SIGNAL(createMainWidget(QWidget *)), \
                SLOT(slotCreateMainWidget(QWidget *)));
-    connect(m_shaman, SIGNAL(createDockWidget(Qt::DockWidgetArea, QDockWidget *)), \
                SLOT(slotCreateDockWidget(Qt::DockWidgetArea, QDockWidget *)));
-    connect(m_shaman, SIGNAL(createAction(QAction *)), SLOT(slotCreateAction(QAction \
*))); +    connect(m_shamanGui, SIGNAL(createMainWidget(QWidget *)), \
SLOT(slotCreateMainWidget(QWidget *))); +    connect(m_shamanGui, \
SIGNAL(createDockWidget(Qt::DockWidgetArea, QDockWidget *)), +            \
SLOT(slotCreateDockWidget(Qt::DockWidgetArea, QDockWidget *))); +    \
connect(m_shamanGui, SIGNAL(createAction(QAction *)), SLOT(slotCreateAction(QAction \
*)));  connect(m_shaman, SIGNAL(initCompleted()), SLOT(setUpGui()));
 
     connect(KApplication::instance(), SIGNAL(aboutToQuit()), this, \
SLOT(aboutToQuit()));  
-    m_shaman->init(Shaman::Base::CachedMode, true);
+    m_shaman->init(Shaman::Base::CachedMode);
 }
 
 MainWindow::~MainWindow()
--- trunk/playground/sysadmin/shaman/shaman/src/MainWindow.h #1091130:1091131
@@ -72,6 +72,7 @@
 
     private:
         Shaman::Base *m_shaman;
+        Shaman::GuiInterface *m_shamanGui;
         KToggleAction *m_menubarAction;
         QMainWindow *m_trickWindow;
         bool m_isReloading;
--- trunk/playground/sysadmin/shaman/shaman/src/updatedatabase/UpdateDatabaseHandler.cpp \
#1091130:1091131 @@ -22,6 +22,7 @@
 #include <KLocale>
 
 #include <QTimer>
+#include <shamanguiinterface.h>
 
 using namespace Shaman;
 
@@ -49,7 +50,8 @@
 void UpdateDatabaseHandler::repositoryStateChanged(Repository::State state)
 {
     if (state == Repository::UpdatingFinished) {
-        Base::instance()->statusBar()->setProgress(100 * \
(Base::instance()->core()->backend()->repositories().indexOf(qobject_cast<Repository*>(QObject::sender())) \
+ 1) +        GuiInterface::instance()->statusBar()->setProgress(100 *
+        (Base::instance()->core()->backend()->repositories().indexOf(qobject_cast<Repository*>(QObject::sender())) \
                + 1)
                                                         / \
Base::instance()->core()->backend()->repositories().count());  }
 }


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

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