source: psi/trunk/libpsi/psiwidgets/psiwidgets.cpp@ 67

Last change on this file since 67 was 2, checked in by dmik, 19 years ago

Imported original Psi 0.10 sources from Affinix

File size: 6.2 KB
Line 
1/*
2 * psiwidgets.cpp - plugin for loading Psi's custom widgets into Qt Designer
3 * Copyright (C) 2003 Michail Pishchagin
4 *
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.
9 *
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.
14 *
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
18 *
19 */
20
21#include "psiwidgets.h"
22
23#include "fancylabel.h"
24#include "busywidget.h"
25#include "iconwidget.h"
26#include "psitextview.h"
27
28static const char *psiwidget_data[] = {
29"16 16 5 1",
30". c None",
31"# c #000000",
32"c c #57acda",
33"b c #72bde6",
34"a c #cde9f8",
35".###..####..###.",
36"#aaa#.#aa#.#aaa#",
37"#abbb##ac##abcc#",
38".##ab##ac##ac##.",
39"..#abc#ac#abc#..",
40"..#abc#ac#abc#..",
41"..#abc#ac#abc#..",
42"..#abc#ac#abc#..",
43"..#abbbbbbbbc#..",
44"...#abbbbbcc#...",
45"....##cccc##....",
46"......#ac#......",
47"......#ac#......",
48"......#ac#......",
49"......#ac#......",
50"......####......"};
51
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
61
62PsiWidgetsPlugin::PsiWidgetsPlugin()
63{
64}
65
66QStringList PsiWidgetsPlugin::keys() const
67{
68 QStringList list;
69 list << "IconLabel";
70 list << "FancyLabel";
71 list << "BusyWidget";
72 list << "IconsetSelect";
73 list << "IconsetDisplay";
74 list << "IconButton";
75 list << "IconToolButton";
76 list << "PsiTextView";
77 list << "URLLabel";
78 return list;
79}
80
81QWidget *PsiWidgetsPlugin::create(const QString &key, QWidget *parent, const char *name)
82{
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 );
101 return 0;
102}
103
104QString PsiWidgetsPlugin::includeFile(const QString &feature) const
105{
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;
115}
116
117QString PsiWidgetsPlugin::group(const QString &feature) const
118{
119 if ( feature == "IconLabel" || feature == "FancyLabel" )
120 return "Display";
121 if ( feature == "BusyWidget" )
122 return "Display";
123 if ( feature == "IconsetSelect" || feature == "IconsetDisplay" )
124 return "Views";
125 if ( feature == "IconButton" || feature == "IconToolButton" )
126 return "Buttons";
127 if ( feature == "PsiTextView" || feature == "URLLabel" )
128 return "Display";
129 return QString::null;
130}
131
132QIconSet PsiWidgetsPlugin::iconSet(const QString &key) const
133{
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 ) );
152 return QIconSet();
153}
154
155QString PsiWidgetsPlugin::toolTip(const QString &feature) const
156{
157 if ( feature == "IconLabel" )
158 return "Icon Label";
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" )
174 return "URL Label";
175 return QString::null;
176}
177
178QString PsiWidgetsPlugin::whatsThis(const QString &feature) const
179{
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;
199}
200
201bool PsiWidgetsPlugin::isContainer(const QString &) const
202{
203 return FALSE;
204}
205
206Q_EXPORT_PLUGIN( PsiWidgetsPlugin )
Note: See TracBrowser for help on using the repository browser.