Revive UiLoader a bit as discussed on list.

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=879713
This commit is contained in:
Kevin Ottens 2008-11-03 21:27:59 +00:00
parent 7c7f8b098a
commit 8a4bc36925
4 changed files with 17 additions and 15 deletions

View File

@ -57,13 +57,13 @@ set(plasma_LIB_SRCS
scripting/dataenginescript.cpp
scripting/runnerscript.cpp
scripting/scriptengine.cpp
scripting/uiloader.cpp
service.cpp
servicejob.cpp
svg.cpp
theme.cpp
tooltipcontent.cpp
tooltipmanager.cpp
uiloader.cpp
version.cpp
view.cpp
wallpaper.cpp
@ -166,7 +166,6 @@ set(plasma_LIB_INCLUDES
theme.h
tooltipcontent.h
tooltipmanager.h
uiloader.h
tooltipmanager.h
version.h
view.h
@ -210,6 +209,7 @@ install(FILES
scripting/dataenginescript.h
scripting/runnerscript.h
scripting/scriptengine.h
scripting/uiloader.h
DESTINATION ${INCLUDE_INSTALL_DIR}/plasma/scripting COMPONENT Devel)

View File

@ -1,2 +1,2 @@
#include "../../plasma/uiloader.h"
#include "../../plasma/scripting/uiloader.h"

View File

@ -19,7 +19,10 @@
#include "uiloader.h"
#include <QGraphicsGridLayout>
#include <QGraphicsLinearLayout>
#include <QStringList>
#include "widgets/checkbox.h"
#include "widgets/combobox.h"
#include "widgets/flashinglabel.h"
@ -62,6 +65,10 @@ UiLoader::UiLoader(QObject *parent)
<< "Slider"
<< "TabBar"
<< "TextEdit";
d->layouts
<< "GridLayout"
<< "LinearLayout";
}
UiLoader::~UiLoader()
@ -112,17 +119,14 @@ QStringList UiLoader::availableLayouts() const
return d->layouts;
}
Layout *UiLoader::createLayout(const QString &className, LayoutItem *parent)
QGraphicsLayout *UiLoader::createLayout(const QString &className, QGraphicsLayoutItem *parent)
{
#ifdef RICHARD_WORK
if (className == QString("HBoxLayout")) {
return new HBoxLayout(parent);
} else if (className == QString("VBoxLayout")) {
return new VBoxLayout(parent);
} else if (className == QString("FlowLayout")) {
return new FlowLayout(parent);
if (className == QString("GridLayout")) {
return new QGraphicsGridLayout(parent);
} else if (className == QString("LinearLayout")) {
return new QGraphicsLinearLayout(parent);
}
#endif
return 0;
}

View File

@ -31,8 +31,6 @@ class QGraphicsProxyWidget;
namespace Plasma
{
class Layout;
class LayoutItem;
class UiLoaderPrivate;
/**
@ -54,7 +52,7 @@ public:
QGraphicsWidget *createWidget(const QString &className, QGraphicsWidget *parent = 0);
QStringList availableLayouts() const;
Layout *createLayout(const QString &className, LayoutItem *parent);
QGraphicsLayout *createLayout(const QString &className, QGraphicsLayoutItem *parent);
private:
UiLoaderPrivate *const d;