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 <QGraphicsGridLayout>
23 #include <QGraphicsLinearLayout>
24 #include <QStringList>
26 #include <Plasma/BusyWidget>
27 #include <Plasma/CheckBox>
28 #include <Plasma/ComboBox>
29 #include <Plasma/FlashingLabel>
30 #include <Plasma/Frame>
31 #include <Plasma/GroupBox>
32 #include <Plasma/IconWidget>
33 #include <Plasma/Label>
34 #include <Plasma/LineEdit>
35 #include <Plasma/Meter>
36 #include <Plasma/PushButton>
37 #include <Plasma/RadioButton>
38 #include <Plasma/ScrollBar>
39 #include <Plasma/SignalPlotter>
40 #include <Plasma/Slider>
41 #include <Plasma/SpinBox>
42 #include <Plasma/SvgWidget>
43 #include <Plasma/TabBar>
44 #include <Plasma/TextEdit>
45 #include <Plasma/ToolButton>
46 #include <Plasma/TreeView>
47 #include <Plasma/WebView>
49 QGraphicsWidget
*createBusyWidget(QGraphicsWidget
*parent
) { return new Plasma::BusyWidget(parent
); }
50 QGraphicsWidget
*createCheckBox(QGraphicsWidget
*parent
) { return new Plasma::CheckBox(parent
); }
51 QGraphicsWidget
*createComboBox(QGraphicsWidget
*parent
) { return new Plasma::ComboBox(parent
); }
52 QGraphicsWidget
*createFlashingLabel(QGraphicsWidget
*parent
) { return new Plasma::FlashingLabel(parent
); }
53 QGraphicsWidget
*createFrame(QGraphicsWidget
*parent
) { return new Plasma::Frame(parent
); }
54 QGraphicsWidget
*createGroupBox(QGraphicsWidget
*parent
) { return new Plasma::GroupBox(parent
); }
55 QGraphicsWidget
*createIconWidget(QGraphicsWidget
*parent
) { return new Plasma::IconWidget(parent
); }
56 QGraphicsWidget
*createLabel(QGraphicsWidget
*parent
) { return new Plasma::Label(parent
); }
57 QGraphicsWidget
*createLineEdit(QGraphicsWidget
*parent
) { return new Plasma::LineEdit(parent
); }
58 QGraphicsWidget
*createMeter(QGraphicsWidget
*parent
) { return new Plasma::Meter(parent
); }
59 QGraphicsWidget
*createPushButton(QGraphicsWidget
*parent
) { return new Plasma::PushButton(parent
); }
60 QGraphicsWidget
*createRadioButton(QGraphicsWidget
*parent
) { return new Plasma::RadioButton(parent
); }
61 QGraphicsWidget
*createScrollBar(QGraphicsWidget
*parent
) { return new Plasma::ScrollBar(parent
); }
62 QGraphicsWidget
*createSignalPlotter(QGraphicsWidget
*parent
) { return new Plasma::SignalPlotter(parent
); }
63 QGraphicsWidget
*createSlider(QGraphicsWidget
*parent
) { return new Plasma::Slider(parent
); }
64 QGraphicsWidget
*createSpinBox(QGraphicsWidget
*parent
) { return new Plasma::SpinBox(parent
); }
65 QGraphicsWidget
*createSvgWidget(QGraphicsWidget
*parent
) { return new Plasma::SvgWidget(parent
); }
66 QGraphicsWidget
*createTabBar(QGraphicsWidget
*parent
) { return new Plasma::TabBar(parent
); }
67 QGraphicsWidget
*createTextEdit(QGraphicsWidget
*parent
) { return new Plasma::TextEdit(parent
); }
68 QGraphicsWidget
*createToolButton(QGraphicsWidget
*parent
) { return new Plasma::ToolButton(parent
); }
69 QGraphicsWidget
*createTreeView(QGraphicsWidget
*parent
) { return new Plasma::TreeView(parent
); }
73 m_widgetCtors
.insert("BusyWidget", createBusyWidget
);
74 m_widgetCtors
.insert("CheckBox", createCheckBox
);
75 m_widgetCtors
.insert("ComboBox", createComboBox
);
76 m_widgetCtors
.insert("FlashingLabel", createFlashingLabel
);
77 m_widgetCtors
.insert("Frame", createFrame
);
78 m_widgetCtors
.insert("GroupBox", createGroupBox
);
79 m_widgetCtors
.insert("IconWidget", createIconWidget
);
80 m_widgetCtors
.insert("Label", createLabel
);
81 m_widgetCtors
.insert("LineEdit", createLineEdit
);
82 m_widgetCtors
.insert("Meter", createMeter
);
83 m_widgetCtors
.insert("PushButton", createPushButton
);
84 m_widgetCtors
.insert("RadioButton", createRadioButton
);
85 m_widgetCtors
.insert("ScrollBar", createScrollBar
);
86 m_widgetCtors
.insert("SignalPlotter", createSignalPlotter
);
87 m_widgetCtors
.insert("Slider", createSlider
);
88 m_widgetCtors
.insert("SpinBox", createSpinBox
);
89 m_widgetCtors
.insert("SvgWidget", createSvgWidget
);
90 m_widgetCtors
.insert("TabBar", createTabBar
);
91 m_widgetCtors
.insert("TextEdit", createTextEdit
);
92 m_widgetCtors
.insert("ToolButton", createToolButton
);
93 m_widgetCtors
.insert("TreeView", createTreeView
);
101 QStringList
UiLoader::availableWidgets() const
103 return m_widgetCtors
.keys();
106 QGraphicsWidget
*UiLoader::createWidget(const QString
&className
, QGraphicsWidget
*parent
)
108 widgetCreator w
= m_widgetCtors
.value(className
, 0);