2 * Copyright 2007 Richard J. Moore <rich@kde.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License as
6 * published by the Free Software Foundation; either version 2, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #include <QStringList>
24 #include <QGraphicsLinearLayout>
26 #include "plasma/widgets/checkbox.h"
27 #include "plasma/widgets/flash.h"
28 #include "plasma/widgets/icon.h"
29 #include "plasma/widgets/label.h"
30 #include "plasma/widgets/pushbutton.h"
31 #include "plasma/widgets/radiobutton.h"
32 #include "plasma/widgets/meter.h"
34 #include "plasma/layouts/flowlayout.h"
39 class UiLoader::Private
46 UiLoader::UiLoader( QObject
*parent
)
69 QStringList
UiLoader::availableWidgets() const
74 Widget
*UiLoader::createWidget( const QString
&className
, Widget
*parent
)
76 if (className
== QString("CheckBox")) {
77 return new CheckBox( parent
);
79 else if (className
== QString("Flash")) {
80 return new Flash( parent
);
82 else if (className
== QString("Icon")) {
83 return new Icon( parent
);
85 else if (className
== QString("Label")) {
86 return new Label( parent
); // Constructor here requires a Widget
88 else if (className
== QString("PushButton")) {
89 return new PushButton( parent
); // Constructor here requires a Widget
91 else if (className
== QString("RadioButton")) {
92 return new RadioButton( parent
);
94 else if (className
== QString("Meter")) {
95 return new Meter( parent
);
101 QStringList
UiLoader::availableLayouts() const
106 QGraphicsLayout
*UiLoader::createLayout( const QString
&className
, QGraphicsLayoutItem
*parent
)
108 if (className
== QString("HBoxLayout")) {
109 return new QGraphicsLinearLayout( Qt::Horizontal
, parent
);
111 else if (className
== QString("VBoxLayout")) {
112 return new QGraphicsLinearLayout( Qt::Vertical
, parent
);
114 else if (className
== QString("FlowLayout")) {
115 return new FlowLayout( parent
);