2
* psiwidgets.cpp - plugin for loading Psi's custom widgets into Qt Designer
3
* Copyright (C) 2003 Michail Pishchagin
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2.1 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
15
* You should have received a copy of the GNU Lesser General Public
16
* License along with this library; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
#include "psiwidgets.h"
23
#include "fancylabel.h"
24
#include "busywidget.h"
25
#include "iconwidget.h"
26
#include "psitextview.h"
28
static const char *psiwidget_data[] = {
52
#define iconlabel_data psiwidget_data
53
#define fancylabel_data psiwidget_data
54
#define busywidget_data psiwidget_data
55
#define iconsetselect_data psiwidget_data
56
#define iconsetdisplay_data psiwidget_data
57
#define iconbutton_data psiwidget_data
58
#define icontoolbutton_data psiwidget_data
59
#define psitextview_data psiwidget_data
60
#define urllabel_data psiwidget_data
62
PsiWidgetsPlugin::PsiWidgetsPlugin()
66
QStringList PsiWidgetsPlugin::keys() const
72
list << "IconsetSelect";
73
list << "IconsetDisplay";
75
list << "IconToolButton";
76
list << "PsiTextView";
81
QWidget *PsiWidgetsPlugin::create(const QString &key, QWidget *parent, const char *name)
83
if ( key == "IconLabel" )
84
return new IconLabel( parent, name );
85
if ( key == "FancyLabel" )
86
return new FancyLabel( parent, name );
87
if ( key == "BusyWidget" )
88
return new BusyWidget( parent, name );
89
if ( key == "IconsetSelect" )
90
return new IconsetSelect( parent, name );
91
if ( key == "IconsetDisplay" )
92
return new IconsetDisplay( parent, name );
93
if ( key == "IconButton" )
94
return new IconButton( parent, name );
95
if ( key == "IconToolButton" )
96
return new IconToolButton( parent, name );
97
if ( key == "PsiTextView" )
98
return new PsiTextView( parent, name );
99
if ( key == "URLLabel" )
100
return new URLLabel( parent, name );
104
QString PsiWidgetsPlugin::includeFile(const QString &feature) const
106
if ( feature == "IconLabel" || feature == "FancyLabel" )
107
return "fancylabel.h";
108
if ( feature == "BusyWidget" )
109
return "busywidget.h";
110
if ( feature == "IconsetSelect" || feature == "IconsetDisplay" || feature == "IconButton" || feature == "IconToolButton" )
111
return "iconwidget.h";
112
if ( feature == "PsiTextView" || feature == "URLLabel" )
113
return "psitextview.h";
114
return QString::null;
117
QString PsiWidgetsPlugin::group(const QString &feature) const
119
if ( feature == "IconLabel" || feature == "FancyLabel" )
121
if ( feature == "BusyWidget" )
123
if ( feature == "IconsetSelect" || feature == "IconsetDisplay" )
125
if ( feature == "IconButton" || feature == "IconToolButton" )
127
if ( feature == "PsiTextView" || feature == "URLLabel" )
129
return QString::null;
132
QIconSet PsiWidgetsPlugin::iconSet(const QString &key) const
134
if ( key == "IconLabel" )
135
return QIconSet( QPixmap( (const char **)iconlabel_data ) );
136
if ( key == "FancyLabel" )
137
return QIconSet( QPixmap( (const char **)fancylabel_data ) );
138
if ( key == "BusyWidget" )
139
return QIconSet( QPixmap( (const char **)busywidget_data ) );
140
if ( key == "IconsetSelect" )
141
return QIconSet( QPixmap( (const char **)iconsetselect_data ) );
142
if ( key == "IconsetDisplay" )
143
return QIconSet( QPixmap( (const char **)iconsetdisplay_data ) );
144
if ( key == "IconButton" )
145
return QIconSet( QPixmap( (const char **)iconbutton_data ) );
146
if ( key == "IconToolButton" )
147
return QIconSet( QPixmap( (const char **)icontoolbutton_data ) );
148
if ( key == "PsiTextView" )
149
return QIconSet( QPixmap( (const char **)psitextview_data ) );
150
if ( key == "URLLabel" )
151
return QIconSet( QPixmap( (const char **)psitextview_data ) );
155
QString PsiWidgetsPlugin::toolTip(const QString &feature) const
157
if ( feature == "IconLabel" )
159
if ( feature == "FancyLabel" )
160
return "Fancy Label";
161
if ( feature == "BusyWidget" )
162
return "Busy Widget";
163
if ( feature == "IconsetSelect" )
164
return "Iconset Select";
165
if ( feature == "IconsetDisplay" )
166
return "Iconset Display";
167
if ( feature == "IconButton" )
168
return "Icon Button";
169
if ( feature == "IconToolButton" )
170
return "Icon Tool Button";
171
if ( feature == "PsiTextView" )
172
return "Psi's Text View";
173
if ( feature == "URLLabel" )
175
return QString::null;
178
QString PsiWidgetsPlugin::whatsThis(const QString &feature) const
180
if ( feature == "IconLabel" )
181
return "Label that can contain animated Icon.";
182
if ( feature == "FancyLabel" )
183
return "Just a Fancy Label. Use it for decoration of dialogs. ;-)";
184
if ( feature == "BusyWidget" )
185
return "Widget for indicating that program is doing something.";
186
if ( feature == "IconsetSelect" )
187
return "Widget for Iconset selection.";
188
if ( feature == "IconsetDisplay" )
189
return "Displays all icons in Iconset.";
190
if ( feature == "IconButton" )
191
return "PushButton that can contain animated Icon.";
192
if ( feature == "IconToolButton" )
193
return "ToolButton that can contain animated Icon.";
194
if ( feature == "PsiTextView" )
195
return "Widget for displaying rich-text data, with inline Icons.";
196
if ( feature == "URLLabel" )
197
return "Widget for displaying clickable URLs.";
198
return QString::null;
201
bool PsiWidgetsPlugin::isContainer(const QString &) const
206
Q_EXPORT_PLUGIN( PsiWidgetsPlugin )